Added the ability to (temporarily) disable selection of undos. This messes up placeholder behavior.
This commit is contained in:
parent
8a6bfe2d24
commit
bab7d58449
2 changed files with 11 additions and 2 deletions
|
|
@ -58,6 +58,7 @@ var EditSession = function(text, mode) {
|
|||
this.$rowCache = [];
|
||||
this.$wrapData = [];
|
||||
this.$foldData = [];
|
||||
this.$undoSelect = true;
|
||||
this.$foldData.toString = function() {
|
||||
var str = "";
|
||||
this.forEach(function(foldLine) {
|
||||
|
|
@ -653,10 +654,11 @@ var EditSession = function(text, mode) {
|
|||
}
|
||||
this.$fromUndo = false;
|
||||
lastUndoRange &&
|
||||
this.$undoSelect &&
|
||||
!dontSelect &&
|
||||
this.selection.setSelectionRange(lastUndoRange);
|
||||
return lastUndoRange;
|
||||
},
|
||||
};
|
||||
|
||||
this.redoChanges = function(deltas, dontSelect) {
|
||||
if (!deltas.length)
|
||||
|
|
@ -674,10 +676,15 @@ var EditSession = function(text, mode) {
|
|||
}
|
||||
this.$fromUndo = false;
|
||||
lastUndoRange &&
|
||||
this.$undoSelect &&
|
||||
!dontSelect &&
|
||||
this.selection.setSelectionRange(lastUndoRange);
|
||||
return lastUndoRange;
|
||||
},
|
||||
};
|
||||
|
||||
this.setUndoSelect = function(enable) {
|
||||
this.$undoSelect = enable;
|
||||
};
|
||||
|
||||
this.$getUndoSelection = function(deltas, isUndo, lastUndoRange) {
|
||||
function isInsert(delta) {
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
|
|||
var anchor = doc.createAnchor(other.row, other.column);
|
||||
_self.others.push(anchor);
|
||||
});
|
||||
session.setUndoSelect(false);
|
||||
};
|
||||
|
||||
this.showOtherMarkers = function() {
|
||||
|
|
@ -189,6 +190,7 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
|
|||
for (var i = 0; i < this.others.length; i++) {
|
||||
this.others[i].detach();
|
||||
}
|
||||
this.session.setUndoSelect(true);
|
||||
};
|
||||
|
||||
this.cancel = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue