From 674cc0d3faecd39103cc5e18eda5462218693b6b Mon Sep 17 00:00:00 2001 From: nightwing Date: Mon, 23 Apr 2012 17:47:17 +0400 Subject: [PATCH] properly remove old keybindings when adding new one --- lib/ace/keyboard/keybinding.js | 5 +++-- lib/ace/keyboard/vim/maps/util.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ace/keyboard/keybinding.js b/lib/ace/keyboard/keybinding.js index 1fe10538..cea77f50 100644 --- a/lib/ace/keyboard/keybinding.js +++ b/lib/ace/keyboard/keybinding.js @@ -62,8 +62,9 @@ var KeyBinding = function(editor) { if (this.$handlers[this.$handlers.length - 1] == kb) return; - this.$handlers = []; - this.setDefaultHandler(this.$defaultHandler); + while (this.$handlers[1]) + this.removeKeyboardHandler(this.$handlers[1]); + this.addKeyboardHandler(kb, 1); }; diff --git a/lib/ace/keyboard/vim/maps/util.js b/lib/ace/keyboard/vim/maps/util.js index 1956aec3..54e66681 100644 --- a/lib/ace/keyboard/vim/maps/util.js +++ b/lib/ace/keyboard/vim/maps/util.js @@ -23,6 +23,7 @@ module.exports = { editor.unsetStyle('normal-mode'); if (editor.commands.recording) editor.commands.toggleRecording(); + editor.setOverwrite(false); }, insertMode: function(editor) { this.currentMode = 'insert';