Merge remote-tracking branch 'ace/master'

This commit is contained in:
Meg Sharkey 2012-03-12 16:57:25 -07:00
commit a7efe1293a
2 changed files with 4 additions and 2 deletions

View file

@ -60,7 +60,7 @@ 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;
this.$undoStackDepth = session.getUndoManager().$undostack ? session.getUndoManager().$undostack.length : -1;
this.setup();
session.selection.on("changeCursor", this.$onCursorChange);
@ -202,7 +202,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.length - this.$undoStackDepth;
for (var i = 0; i < undosRequired; i++) {
undoManager.undo(true);
}

View file

@ -140,6 +140,8 @@ 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}]);