Move the cursor on pageUp / pageDown

Previously it was only moving the scrollTop, but not the cursors. 
Affected on the react editor.

Refs #2423
This commit is contained in:
Ben Ogle
2014-06-11 17:19:59 -07:00
parent 01b4ff24b9
commit 7e6e61905b
2 changed files with 16 additions and 3 deletions

View File

@@ -1605,10 +1605,18 @@ class Editor extends Model
@getCursor().autoscroll()
pageUp: ->
@setScrollTop(@getScrollTop() - @getHeight())
newScrollTop = @getScrollTop() - @getHeight()
@moveCursorUp(@getRowsPerPage())
@setScrollTop(newScrollTop)
pageDown: ->
@setScrollTop(@getScrollTop() + @getHeight())
newScrollTop = @getScrollTop() + @getHeight()
@moveCursorDown(@getRowsPerPage())
@setScrollTop(newScrollTop)
# Returns the number of rows per page
getRowsPerPage: ->
Math.max(1, Math.ceil(@getHeight() / @getLineHeightInPixels()))
moveCursors: (fn) ->
@movingCursors = true