scroll selection into view only after find/replace

Conflicts:

	lib/ace/editor.js
This commit is contained in:
nightwing 2012-04-08 15:49:54 +04:00 committed by Fabian Jakobs
commit b44d19ed63

View file

@ -316,11 +316,7 @@ var Editor = function(renderer, session) {
this.renderer.updateCursor();
if (!this.$blockScrolling) {
var selection = this.getSelection();
if (selection.isEmpty())
this.renderer.scrollCursorIntoView(selection.getCursor());
else
this.renderer.scrollSelectionIntoView(selection.getSelectionLead(), selection.getSelectionAnchor());
this.renderer.scrollCursorIntoView();
}
// move text input over the cursor
@ -1155,11 +1151,13 @@ var Editor = function(renderer, session) {
if (!range)
return replaced;
if(this.$tryReplace(range, replacement)) {
if (this.$tryReplace(range, replacement)) {
replaced = 1;
}
if (range !== null)
if (range !== null) {
this.selection.setSelectionRange(range);
this.renderer.scrollSelectionIntoView(range.start, range.end);
}
return replaced;
};
@ -1240,6 +1238,7 @@ var Editor = function(renderer, session) {
var range = this.$search.find(this.session);
if (range) {
this.session.unfold(range);
this.$blockScrolling += 1;
this.selection.setSelectionRange(range);
this.$blockScrolling -= 1;
@ -1251,6 +1250,8 @@ var Editor = function(renderer, session) {
//@todo scroll X
//if (!this.isRowFullyVisible(cursor.row))
//this.scrollToLine(cursor.row, true);
this.renderer.scrollSelectionIntoView(range.start, range.end);
}
};