don't scroll on selectAll

This commit is contained in:
nightwing 2011-01-06 16:15:01 +04:00 committed by Fabian Jakobs
commit 9ddc3dbc3b
2 changed files with 14 additions and 7 deletions

View file

@ -233,11 +233,11 @@ var Editor =function(renderer, doc) {
this.renderer.updateLines(rows.first, rows.last);
};
this.onCursorChange = function() {
this.onCursorChange = function(e) {
this.$highlightBrackets();
this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite);
if (!this.$blockScrolling) {
if (!this.$blockScrolling && (!e || !e.blockScrolling)) {
this.renderer.scrollCursorIntoView();
}
this.$updateHighlightActiveLine();
@ -256,7 +256,7 @@ var Editor =function(renderer, doc) {
}
};
this.onSelectionChange = function() {
this.onSelectionChange = function(e) {
if (this.$selectionMarker) {
this.renderer.removeMarker(this.$selectionMarker);
}
@ -268,7 +268,7 @@ var Editor =function(renderer, doc) {
this.$selectionMarker = this.renderer.addMarker(range, "ace_selection", style);
}
this.onCursorChange();
this.onCursorChange(e);
};
this.onDocumentChangeBreakpoint = function() {

View file

@ -150,9 +150,16 @@ var Selection = function(doc) {
var lastRow = this.doc.getLength() - 1;
this.setSelectionAnchor(lastRow, this.doc.getLine(lastRow).length);
this.$moveSelection(function() {
this.moveCursorTo(0, 0);
});
if (!this.selectionAnchor) {
this.selectionAnchor = this.$clone(this.selectionLead);
}
var cursor = {row:0, column:0};
// only dispatch change if the cursor actually changed
if (cursor.row !== this.selectionLead.row || cursor.column !== this.selectionLead.column) {
this.selectionLead = cursor;
this._dispatchEvent("changeSelection", {blockScrolling: true});
}
};
this.setSelectionRange = function(range, reverse) {