Created
September 21, 2017 18:33
-
-
Save t9md/c70f5d6528904601755422ae66124f26 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class setCursorAtStart extends Operator | |
@extend() | |
restorePositions: false | |
mutateSelection: (selection) -> | |
selection.cursor.setBufferPosition(@getPointForSelection(selection)) | |
getPointForSelection: (selection) -> | |
@swrap(selection).getBufferPositionFor("start") | |
class setCursorAtEnd extends setCursorAtStart | |
@extend() | |
getPointForSelection: (selection) -> | |
@swrap(selection).getBufferPositionFor("end").translate([0, -1]) | |
class setCursorAtHead extends setCursorAtEnd | |
@extend() | |
getPointForSelection: (selection) -> | |
if selection.isReversed() | |
@swrap(selection).getBufferPositionFor("start") | |
else | |
super |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment