Implement select page up/down in Editor

This commit is contained in:
Kevin Sawicki 2014-06-20 11:30:23 -07:00
parent 01a4032895
commit 148180adda
2 changed files with 8 additions and 2 deletions

View File

@ -380,8 +380,8 @@ EditorComponent = React.createClass
'core:select-down': => editor.selectDown()
'core:select-to-top': => editor.selectToTop()
'core:select-to-bottom': => editor.selectToBottom()
'core:select-page-up': => editor.selectUp(@getPageRows())
'core:select-page-down': => editor.selectDown(@getPageRows())
'core:select-page-up': => editor.selectPageUp()
'core:select-page-down': => editor.selectPageDown()
'editor:indent': => editor.indent()
'editor:auto-indent': => editor.autoIndentSelectedRows()
'editor:indent-selected-rows': => editor.indentSelectedRows()

View File

@ -1589,6 +1589,12 @@ class Editor extends Model
@moveCursorDown(@getRowsPerPage())
@setScrollTop(newScrollTop)
selectPageUp: ->
@selectUp(@getRowsPerPage())
selectPageDown: ->
@selectDown(@getRowsPerPage())
# Returns the number of rows per page
getRowsPerPage: ->
Math.max(1, Math.ceil(@getHeight() / @getLineHeightInPixels()))