fix find next scroll into view

This commit is contained in:
Fabian Jakobs 2011-11-11 15:50:56 +01:00
commit dcfecdc1a4

View file

@ -923,6 +923,10 @@ var Editor = function(renderer, session) {
return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow()); return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow());
}; };
this.isRowFullyVisible = function(row) {
return (row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow());
};
this.$getVisibleRowCount = function() { this.$getVisibleRowCount = function() {
return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1; return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;
}; };
@ -1037,10 +1041,8 @@ var Editor = function(renderer, session) {
this.$blockScrolling += 1; this.$blockScrolling += 1;
this.moveCursorTo(lineNumber-1, column || 0); this.moveCursorTo(lineNumber-1, column || 0);
this.$blockScrolling -= 1; this.$blockScrolling -= 1;
if (!this.isRowFullyVisible(this.getCursorPosition().row))
if (!this.isRowVisible(this.getCursorPosition().row)) {
this.scrollToLine(lineNumber, true); this.scrollToLine(lineNumber, true);
}
}; };
this.navigateTo = function(row, column) { this.navigateTo = function(row, column) {
@ -1192,9 +1194,8 @@ var Editor = function(renderer, session) {
}; };
this.$find = function(backwards) { this.$find = function(backwards) {
if (!this.selection.isEmpty()) { if (!this.selection.isEmpty())
this.$search.set({needle: this.session.getTextRange(this.getSelectionRange())}); this.$search.set({needle: this.session.getTextRange(this.getSelectionRange())});
}
if (typeof backwards != "undefined") if (typeof backwards != "undefined")
this.$search.set({backwards: backwards}); this.$search.set({backwards: backwards});