From bb55d8f406d4253525a9b37bfdcf842c73ade5f5 Mon Sep 17 00:00:00 2001 From: James Allen Date: Fri, 25 Jul 2014 21:10:50 +0100 Subject: [PATCH] Reset undo state when switching documents --- .../editor/directives/aceEditor/undo/UndoManager.coffee | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor/undo/UndoManager.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor/undo/UndoManager.coffee index f53bfa69db..d30e2f6718 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor/undo/UndoManager.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor/undo/UndoManager.coffee @@ -14,6 +14,7 @@ define [ @nextUpdateIsRemote = false @editor.on "changeSession", (e) => + @reset() e.session.setUndoManager(@) showUndoConflictWarning: () -> @@ -26,10 +27,16 @@ define [ , 4000 reset: () -> + @firstUpdate = true @undoStack = [] @redoStack = [] execute: (options) -> + if @firstUpdate + # The first update we receive is Ace setting the document, which we should + # ignore + @firstUpdate = false + return aceDeltaSets = options.args[0] @session = options.args[1] return if !aceDeltaSets?