fix selectAll after anchor merge
This commit is contained in:
parent
fcf4e764a3
commit
0a3111c8fb
3 changed files with 15 additions and 9 deletions
|
|
@ -48,7 +48,7 @@ canon.addCommand({
|
||||||
|
|
||||||
canon.addCommand({
|
canon.addCommand({
|
||||||
name: "selectall",
|
name: "selectall",
|
||||||
exec: function(env, args, request) { env.editor.getSelection().selectAll(); }
|
exec: function(env, args, request) { env.editor.selectAll(); }
|
||||||
});
|
});
|
||||||
canon.addCommand({
|
canon.addCommand({
|
||||||
name: "removeline",
|
name: "removeline",
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ var Editor =function(renderer, session) {
|
||||||
|
|
||||||
this.$selectionMarker = null;
|
this.$selectionMarker = null;
|
||||||
this.$highlightLineMarker = null;
|
this.$highlightLineMarker = null;
|
||||||
this.$blockScrolling = false;
|
this.$blockScrolling = 0;
|
||||||
|
|
||||||
this.$search = new Search().set({
|
this.$search = new Search().set({
|
||||||
wrap: true
|
wrap: true
|
||||||
|
|
@ -285,7 +285,7 @@ var Editor =function(renderer, session) {
|
||||||
this.onCursorChange = function(e) {
|
this.onCursorChange = function(e) {
|
||||||
this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite);
|
this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite);
|
||||||
|
|
||||||
if (!this.$blockScrolling && (!e || !e.blockScrolling)) {
|
if (!this.$blockScrolling) {
|
||||||
this.renderer.scrollCursorIntoView();
|
this.renderer.scrollCursorIntoView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -459,9 +459,9 @@ var Editor =function(renderer, session) {
|
||||||
|
|
||||||
this.$overwrite = overwrite;
|
this.$overwrite = overwrite;
|
||||||
|
|
||||||
this.$blockScrolling = true;
|
this.$blockScrolling += 1;
|
||||||
this.onCursorChange();
|
this.onCursorChange();
|
||||||
this.$blockScrolling = false;
|
this.$blockScrolling -= 1;
|
||||||
|
|
||||||
this._dispatchEvent("changeOverwrite", {data: overwrite});
|
this._dispatchEvent("changeOverwrite", {data: overwrite});
|
||||||
};
|
};
|
||||||
|
|
@ -778,6 +778,13 @@ var Editor =function(renderer, session) {
|
||||||
return this.selection.getRange();
|
return this.selection.getRange();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
this.selectAll = function() {
|
||||||
|
this.$blockScrolling += 1;
|
||||||
|
this.selection.selectAll();
|
||||||
|
this.$blockScrolling -= 1;
|
||||||
|
};
|
||||||
|
|
||||||
this.clearSelection = function() {
|
this.clearSelection = function() {
|
||||||
this.selection.clearSelection();
|
this.selection.clearSelection();
|
||||||
};
|
};
|
||||||
|
|
@ -794,9 +801,9 @@ var Editor =function(renderer, session) {
|
||||||
this.gotoLine = function(lineNumber, row) {
|
this.gotoLine = function(lineNumber, row) {
|
||||||
this.selection.clearSelection();
|
this.selection.clearSelection();
|
||||||
|
|
||||||
this.$blockScrolling = true;
|
this.$blockScrolling += 1;
|
||||||
this.moveCursorTo(lineNumber-1, row || 0);
|
this.moveCursorTo(lineNumber-1, row || 0);
|
||||||
this.$blockScrolling = false;
|
this.$blockScrolling -= 1;
|
||||||
|
|
||||||
if (!this.isRowVisible(this.getCursorPosition().row)) {
|
if (!this.isRowVisible(this.getCursorPosition().row)) {
|
||||||
this.scrollToRow(lineNumber - 1 - Math.floor(this.getVisibleRowCount() / 2));
|
this.scrollToRow(lineNumber - 1 - Math.floor(this.getVisibleRowCount() / 2));
|
||||||
|
|
|
||||||
|
|
@ -160,8 +160,7 @@ var Selection = function(session) {
|
||||||
this.selectAll = function() {
|
this.selectAll = function() {
|
||||||
var lastRow = this.doc.getLength() - 1;
|
var lastRow = this.doc.getLength() - 1;
|
||||||
this.setSelectionAnchor(lastRow, this.doc.getLine(lastRow).length);
|
this.setSelectionAnchor(lastRow, this.doc.getLine(lastRow).length);
|
||||||
this.setSelectionLead(0, 0);
|
this.moveCursorTo(0, 0);
|
||||||
// this._dispatchEvent("changeSelection", {blockScrolling: true});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setSelectionRange = function(range, reverse) {
|
this.setSelectionRange = function(range, reverse) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue