From bbf2cdb3c1ec24bd714dc8aef07fd1ccb4c373ab Mon Sep 17 00:00:00 2001 From: Ruben Daniels Date: Thu, 26 Feb 2015 18:59:58 +0000 Subject: [PATCH] Small fix for debugger. Add ability to set undo manager for document --- package.json | 2 +- plugins/c9.ide.editors/document.js | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index ae09e6c3..1ac39e94 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "c9.ide.find": "#989c06e6a7", "c9.ide.find.infiles": "#28b3cfcb47", "c9.ide.find.replace": "#43a6b95e6a", - "c9.ide.run.debug": "#0c1f549611", + "c9.ide.run.debug": "#36245ee2aa", "c9.ide.ace.emmet": "#e5f1a92ac3", "c9.ide.ace.gotoline": "#4d1a93172c", "c9.ide.ace.keymaps": "#1e42293fb9", diff --git a/plugins/c9.ide.editors/document.js b/plugins/c9.ide.editors/document.js index 25f217ea..a7ec71ab 100644 --- a/plugins/c9.ide.editors/document.js +++ b/plugins/c9.ide.editors/document.js @@ -39,13 +39,16 @@ define(function(require, module, exports) { // Listen to changes and detect when the value of the editor // is different from what is on disk - undoManager.on("change", function(e) { - var c = !undoManager.isAtBookmark(); - if (changed !== c || undoManager.position == -1) { - changed = c; - emit("changed", { changed: c }); - } - }); + function initUndo(){ + undoManager.on("change", function(e) { + var c = !undoManager.isAtBookmark(); + if (changed !== c || undoManager.position == -1) { + changed = c; + emit("changed", { changed: c }); + } + }); + } + initUndo(); /***** Methods *****/ @@ -401,6 +404,11 @@ define(function(require, module, exports) { * @property {UndoManager} undoManager */ get undoManager(){ return undoManager; }, + set undoManager(newUndo){ + undoManager.unload(); + undoManager = newUndo; + initUndo(); + }, _events: [ /**