fix selectAll after anchor merge

This commit is contained in:
Fabian Jakobs 2011-02-11 15:43:34 +01:00
commit 0a3111c8fb
3 changed files with 15 additions and 9 deletions

View file

@ -48,7 +48,7 @@ canon.addCommand({
canon.addCommand({
name: "selectall",
exec: function(env, args, request) { env.editor.getSelection().selectAll(); }
exec: function(env, args, request) { env.editor.selectAll(); }
});
canon.addCommand({
name: "removeline",

View file

@ -73,7 +73,7 @@ var Editor =function(renderer, session) {
this.$selectionMarker = null;
this.$highlightLineMarker = null;
this.$blockScrolling = false;
this.$blockScrolling = 0;
this.$search = new Search().set({
wrap: true
@ -285,7 +285,7 @@ var Editor =function(renderer, session) {
this.onCursorChange = function(e) {
this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite);
if (!this.$blockScrolling && (!e || !e.blockScrolling)) {
if (!this.$blockScrolling) {
this.renderer.scrollCursorIntoView();
}
@ -459,9 +459,9 @@ var Editor =function(renderer, session) {
this.$overwrite = overwrite;
this.$blockScrolling = true;
this.$blockScrolling += 1;
this.onCursorChange();
this.$blockScrolling = false;
this.$blockScrolling -= 1;
this._dispatchEvent("changeOverwrite", {data: overwrite});
};
@ -778,6 +778,13 @@ var Editor =function(renderer, session) {
return this.selection.getRange();
};
this.selectAll = function() {
this.$blockScrolling += 1;
this.selection.selectAll();
this.$blockScrolling -= 1;
};
this.clearSelection = function() {
this.selection.clearSelection();
};
@ -794,9 +801,9 @@ var Editor =function(renderer, session) {
this.gotoLine = function(lineNumber, row) {
this.selection.clearSelection();
this.$blockScrolling = true;
this.$blockScrolling += 1;
this.moveCursorTo(lineNumber-1, row || 0);
this.$blockScrolling = false;
this.$blockScrolling -= 1;
if (!this.isRowVisible(this.getCursorPosition().row)) {
this.scrollToRow(lineNumber - 1 - Math.floor(this.getVisibleRowCount() / 2));

View file

@ -160,8 +160,7 @@ var Selection = function(session) {
this.selectAll = function() {
var lastRow = this.doc.getLength() - 1;
this.setSelectionAnchor(lastRow, this.doc.getLine(lastRow).length);
this.setSelectionLead(0, 0);
// this._dispatchEvent("changeSelection", {blockScrolling: true});
this.moveCursorTo(0, 0);
};
this.setSelectionRange = function(range, reverse) {