aboutsummaryrefslogtreecommitdiff
path: root/atom/packages/vim-mode/lib/scroll.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'atom/packages/vim-mode/lib/scroll.coffee')
-rw-r--r--atom/packages/vim-mode/lib/scroll.coffee24
1 files changed, 23 insertions, 1 deletions
diff --git a/atom/packages/vim-mode/lib/scroll.coffee b/atom/packages/vim-mode/lib/scroll.coffee
index 1bc1258..275f0f9 100644
--- a/atom/packages/vim-mode/lib/scroll.coffee
+++ b/atom/packages/vim-mode/lib/scroll.coffee
@@ -84,5 +84,27 @@ class ScrollCursorToBottom extends ScrollCursor
moveToFirstNonBlank: ->
@editor.moveToFirstCharacterOfLine()
+class ScrollHorizontal
+ isComplete: -> true
+ isRecordable: -> false
+ constructor: (@editorElement) ->
+ @editor = @editorElement.getModel()
+ cursorPos = @editor.getCursorScreenPosition()
+ @pixel = @editorElement.pixelPositionForScreenPosition(cursorPos).left
+ @cursor = @editor.getLastCursor()
+
+ putCursorOnScreen: ->
+ @editor.scrollToCursorPosition({center: false})
+
+class ScrollCursorToLeft extends ScrollHorizontal
+ execute: ->
+ @editor.setScrollLeft(@pixel)
+ @putCursorOnScreen()
+
+class ScrollCursorToRight extends ScrollHorizontal
+ execute: ->
+ @editor.setScrollRight(@pixel)
+ @putCursorOnScreen()
+
module.exports = {ScrollDown, ScrollUp, ScrollCursorToTop, ScrollCursorToMiddle,
- ScrollCursorToBottom}
+ ScrollCursorToBottom, ScrollCursorToLeft, ScrollCursorToRight}