Added the ability to (temporarily) disable selection of undos. This messes up placeholder behavior.

This commit is contained in:
Zef Hemel 2011-12-05 15:39:19 +01:00
commit bab7d58449
2 changed files with 11 additions and 2 deletions

View file

@ -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) {

View file

@ -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() {