mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 02:17:59 +01:00
added -- MESSAGE -- mode handling to muttator. This will be the only muttator-specific mode added to the VIM core.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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];
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -78,16 +78,16 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
||||
</keyset>
|
||||
|
||||
<statusbar id="status-bar" class="hl-StatusLine">
|
||||
<hbox insertbefore="statusText" id="vimperator-statusline" flex="1" height="10" hidden="false" align="center">
|
||||
<textbox class="plain" id="vimperator-statusline-field-url" readonly="false" flex="1" crop="end"/>
|
||||
<label class="plain" id="vimperator-statusline-field-inputbuffer" flex="0"/>
|
||||
<label class="plain" id="vimperator-statusline-field-progress" flex="0"/>
|
||||
<label class="plain" id="vimperator-statusline-field-tabcount" flex="0"/>
|
||||
<label class="plain" id="vimperator-statusline-field-bufferposition" flex="0"/>
|
||||
<hbox insertafter="statusTextBox" id="vimperator-statusline" flex="1" height="10" hidden="false" align="center">
|
||||
<statusbarpanel class="plain" id="vimperator-statusline-field-url" readonly="false" flex="1" crop="end"/>
|
||||
<statusbarpanel class="plain" id="vimperator-statusline-field-inputbuffer" flex="0"/>
|
||||
<statusbarpanel class="plain" id="vimperator-statusline-field-progress" flex="0"/>
|
||||
<statusbarpanel class="plain" id="vimperator-statusline-field-tabcount" flex="0"/>
|
||||
<statusbarpanel class="plain" id="vimperator-statusline-field-bufferposition" flex="0"/>
|
||||
</hbox>
|
||||
<!-- just hide them since other elements expect them -->
|
||||
<statusbarpanel id="statusbar-display" hidden="true"/>
|
||||
<statusbarpanel id="statusbar-progresspanel" hidden="true"/>
|
||||
<statusbarpanel id="statusText" hidden="true"/>
|
||||
<statusbarpanel id="statusbarpanel-progress" hidden="true"/>
|
||||
</statusbar>
|
||||
|
||||
<vbox id="vimperator-container" hidden="false">
|
||||
|
||||
@@ -164,6 +164,7 @@ const vimperator = (function () //{{{
|
||||
document.commandDispatcher.focusedElement.blur();
|
||||
|
||||
var elem = vimperator.config.mainWidget || content;
|
||||
if (elem != document.commandDispatcher.focusedElement)
|
||||
elem.focus();
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user