move page down selection back into the editor because it requires knowledge about the visible viewport
This commit is contained in:
parent
7212563e3a
commit
ff9485f617
2 changed files with 22 additions and 21 deletions
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue