diff --git a/content/events.js b/content/events.js
index f202962a..1532d628 100644
--- a/content/events.js
+++ b/content/events.js
@@ -772,8 +772,17 @@ vimperator.Events = function () //{{{
vimperator.modes.main = vimperator.modes.TEXTAREA;
vimperator.buffer.lastInputField = elem;
}
+ else if (vimperator.config.name == "Muttator" && (!elem || elem instanceof HTMLElement))
+ {
+ // we switch to -- MESSAGE -- mode for muttator, whenever no tree or an HTML element
+ // which is NOT an input element is selected
+ vimperator.mode = vimperator.modes.MESSAGE;
+ return;
+ }
+
else if (vimperator.mode == vimperator.modes.INSERT ||
vimperator.mode == vimperator.modes.TEXTAREA ||
+ // vimperator.mode == vimperator.modes.MESSAGE ||
vimperator.mode == vimperator.modes.VISUAL)
{
// FIXME: currently this hack is disabled to make macros work
diff --git a/content/mappings.js b/content/mappings.js
index 3a434436..03c4a9da 100644
--- a/content/mappings.js
+++ b/content/mappings.js
@@ -355,12 +355,14 @@ vimperator.Mappings = function () //{{{
vimperator.modes.VISUAL,
vimperator.modes.HINTS,
vimperator.modes.COMMAND_LINE,
+ vimperator.modes.MESSAGE,
vimperator.modes.CARET,
vimperator.modes.TEXTAREA];
var noninsertModes = [vimperator.modes.NORMAL,
vimperator.modes.VISUAL,
vimperator.modes.HINTS,
+ vimperator.modes.MESSAGE,
vimperator.modes.CARET,
vimperator.modes.TEXTAREA];
diff --git a/content/modes.js b/content/modes.js
index c7910e0b..81afc984 100644
--- a/content/modes.js
+++ b/content/modes.js
@@ -77,6 +77,8 @@ vimperator.modes = (function () //{{{
return "-- CARET" + ext;
case vimperator.modes.TEXTAREA:
return "-- TEXTAREA" + ext;
+ case vimperator.modes.MESSAGE:
+ return "-- MESSAGE" + ext;
case vimperator.modes.CUSTOM:
return "-- " + vimperator.plugins.mode + ext;
default: // NORMAL mode
@@ -159,7 +161,8 @@ vimperator.modes = (function () //{{{
COMMAND_LINE: 1 << 4,
CARET: 1 << 5, // text cursor is visible
TEXTAREA: 1 << 6, // text cursor is in a HTMLTextAreaElement
- CUSTOM: 1 << 7,
+ MESSAGE: 1 << 7, // for now only used in Muttator when the message has focus
+ CUSTOM: 1 << 8,
// extended modes, can include multiple modes, and even main modes
EX: 1 << 10,
INPUT_MULTILINE: 1 << 11,
@@ -177,7 +180,7 @@ vimperator.modes = (function () //{{{
__iterator__: function ()
{
var modes = [this.NONE, this.NORMAL, this.INSERT, this.VISUAL, this.HINTS,
- this.COMMAND_LINE, this.CARET, this.TEXTAREA, this.CUSTOM];
+ this.COMMAND_LINE, this.CARET, this.TEXTAREA, this.MESSAGE, this.CUSTOM];
for (var i = 0; i < modes.length; i++)
yield modes[i];
diff --git a/content/muttator.xul b/content/muttator.xul
index fb81e25b..516a4d7e 100644
--- a/content/muttator.xul
+++ b/content/muttator.xul
@@ -78,16 +78,16 @@ the terms of any one of the MPL, the GPL or the LGPL.
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
diff --git a/content/vim.js b/content/vim.js
index 477d4b98..51ab995e 100644
--- a/content/vim.js
+++ b/content/vim.js
@@ -164,7 +164,8 @@ const vimperator = (function () //{{{
document.commandDispatcher.focusedElement.blur();
var elem = vimperator.config.mainWidget || content;
- elem.focus();
+ if (elem != document.commandDispatcher.focusedElement)
+ elem.focus();
},
// partial sixth level expression evaluation