Typo followup: now handling both of ACE and Cloud9 worlds
This commit is contained in:
parent
0329c10031
commit
ec022c3abb
2 changed files with 3 additions and 4 deletions
|
|
@ -60,7 +60,8 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
|
|||
|
||||
this.$pos = pos;
|
||||
// Used for reset
|
||||
this.$undoStackDepth = session.getUndoManager().$undostack ? session.getUndoManager().$undostack.length : -1;
|
||||
var undoStack = session.getUndoManager().$undoStack || session.getUndoManager().$undostack || {length: -1};
|
||||
this.$undoStackDepth = undoStack.length;
|
||||
this.setup();
|
||||
|
||||
session.selection.on("changeCursor", this.$onCursorChange);
|
||||
|
|
@ -202,7 +203,7 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
|
|||
if(this.$undoStackDepth === -1)
|
||||
throw Error("Canceling placeholders only supported with undo manager attached to session.");
|
||||
var undoManager = this.session.getUndoManager();
|
||||
var undosRequired = undoManager.$undostack.length - this.$undoStackDepth;
|
||||
var undosRequired = (undoManager.$undoStack || undoManager.$undostack).length - this.$undoStackDepth;
|
||||
for (var i = 0; i < undosRequired; i++) {
|
||||
undoManager.undo(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,8 +140,6 @@ module.exports = {
|
|||
"test: cancel": function(next) {
|
||||
var session = new EditSession("var a = 10;\nconsole.log(a, a);", new JavaScriptMode());
|
||||
session.setUndoManager(new UndoManager());
|
||||
// hack around the difference between full ACE context and C9 world
|
||||
session.getUndoManager().$undostack = session.getUndoManager().$undoStack;
|
||||
var editor = new Editor(new MockRenderer(), session);
|
||||
var p = new PlaceHolder(session, 1, {row: 0, column: 4}, [{row: 1, column: 12}, {row: 1, column: 15}]);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue