move page down selection back into the editor because it requires knowledge about the visible viewport

This commit is contained in:
Fabian Jakobs 2010-04-26 15:09:55 +02:00
commit ff9485f617
2 changed files with 22 additions and 21 deletions

View file

@ -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());

View file

@ -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);
};