From 8292f6384cbe658d8e538b5db67bdec86f5bb702 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 8 Oct 2009 15:40:18 -0400 Subject: [PATCH] Fix mappings when mode.addMode used after initialization. --HG-- extra : rebase_source : 03fcc73999f01ef1987cf22c0061fbcfebf0bc23 --- common/content/mappings.js | 9 +++++++++ common/content/modes.js | 2 ++ 2 files changed, 11 insertions(+) diff --git a/common/content/mappings.js b/common/content/mappings.js index eb4e032d..bdad8699 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -355,6 +355,15 @@ function Mappings() //{{{ */ getUserIterator: function (mode) mappingsIterator(mode, user), + addMode: function (mode) + { + if (!(mode in user || mode in main)) + { + main[mode] = []; + user[mode] = []; + } + }, + /** * Adds a new default key mapping. * diff --git a/common/content/modes.js b/common/content/modes.js index 2c9932ce..4c742831 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -134,6 +134,8 @@ const modes = (function () //{{{ modeMap[name].display = modeMap[name].display || function () disp; if (!extended) mainModes.push(this[name]); + if ("mappings" in modules) + mappings.addMode(this[name]); }, getMode: function (name) modeMap[name],