From a682373e27f5ff366a1dd59f261f88c22b605cfd Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 9 Oct 2010 02:26:12 -0400 Subject: [PATCH] Replace spurious modes.replace call that Doug, er, warned be about before I committed it. --HG-- branch : mode-refactoring --- common/content/editor.js | 2 +- common/content/modes.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common/content/editor.js b/common/content/editor.js index 94347886..b737a93a 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -701,7 +701,7 @@ const Editor = Module("editor", { function (count) { dactyl.assert(editor.isTextEdit); editor.executeCommand("cmd_cut"); - modes.replace(modes.INSERT, modes.TEXT_EDIT); + modes.push(modes.INSERT); }); mappings.add([modes.VISUAL], diff --git a/common/content/modes.js b/common/content/modes.js index 141c6afa..39e4f836 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -265,8 +265,10 @@ const Modes = Module("modes", { }, replace: function (mode, oldMode) { - // TODO: This should really be done in one step. - this.pop(oldMode); + while (oldMode && this._modeStack.length > 1 && this.main != oldMode) + this.pop(); + + this.set(mode, null, null, { push: this.topOfStack, pop: this._modeStack.pop() }); this.push(mode); },