diff --git a/src/ace/Editor.js b/src/ace/Editor.js index 40ee1bcb..671ff918 100644 --- a/src/ace/Editor.js +++ b/src/ace/Editor.js @@ -547,6 +547,28 @@ ace.Editor = function(renderer, doc) { return firstRow - (lastRow - firstRow) + 1; }; + this.selectPageDown = function() { + var row = this.getPageDownRow() + Math.floor(this.getVisibleRowCount() / 2); + + this.scrollPageDown(); + + var selection = this.getSelection(); + selection.$moveSelection(function() { + selection.moveCursorTo(row, selection.getSelectionLead().column); + }); + }; + + this.selectPageUp = function() { + var visibleRows = this.getLastVisibleRow() - this.getFirstVisibleRow(); + var row = this.getPageUpRow() + Math.round(visibleRows / 2); + + this.scrollPageUp(); + + var selection = this.getSelection(); + selection.$moveSelection(function() { + selection.moveCursorTo(row, selection.getSelectionLead().column); + }); + }; this.scrollPageDown = function() { this.scrollToRow(this.getPageDownRow()); diff --git a/src/ace/Selection.js b/src/ace/Selection.js index f1048851..e209748f 100644 --- a/src/ace/Selection.js +++ b/src/ace/Selection.js @@ -157,27 +157,6 @@ ace.Selection = function(doc) { this.$moveSelection(this.moveCursorLineEnd); }; - this.selectPageDown = function() { - var row = this.getPageDownRow() + Math.floor(this.getVisibleRowCount() / 2); - - this.scrollPageDown(); - - this.$moveSelection(function() { - this.moveCursorTo(row, this.selectionLead.column); - }); - }; - - this.selectPageUp = function() { - var visibleRows = this.getLastVisibleRow() - this.getFirstVisibleRow(); - var row = this.getPageUpRow() + Math.round(visibleRows / 2); - - this.scrollPageUp(); - - this.$moveSelection(function() { - this.moveCursorTo(row, this.selectionLead.column); - }); - }; - this.selectFileEnd = function() { this.$moveSelection(this.moveCursorFileEnd); };