mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 04:07:58 +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.modes.main = vimperator.modes.TEXTAREA;
|
||||||
vimperator.buffer.lastInputField = elem;
|
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 ||
|
else if (vimperator.mode == vimperator.modes.INSERT ||
|
||||||
vimperator.mode == vimperator.modes.TEXTAREA ||
|
vimperator.mode == vimperator.modes.TEXTAREA ||
|
||||||
|
// vimperator.mode == vimperator.modes.MESSAGE ||
|
||||||
vimperator.mode == vimperator.modes.VISUAL)
|
vimperator.mode == vimperator.modes.VISUAL)
|
||||||
{
|
{
|
||||||
// FIXME: currently this hack is disabled to make macros work
|
// FIXME: currently this hack is disabled to make macros work
|
||||||
|
|||||||
@@ -355,12 +355,14 @@ vimperator.Mappings = function () //{{{
|
|||||||
vimperator.modes.VISUAL,
|
vimperator.modes.VISUAL,
|
||||||
vimperator.modes.HINTS,
|
vimperator.modes.HINTS,
|
||||||
vimperator.modes.COMMAND_LINE,
|
vimperator.modes.COMMAND_LINE,
|
||||||
|
vimperator.modes.MESSAGE,
|
||||||
vimperator.modes.CARET,
|
vimperator.modes.CARET,
|
||||||
vimperator.modes.TEXTAREA];
|
vimperator.modes.TEXTAREA];
|
||||||
|
|
||||||
var noninsertModes = [vimperator.modes.NORMAL,
|
var noninsertModes = [vimperator.modes.NORMAL,
|
||||||
vimperator.modes.VISUAL,
|
vimperator.modes.VISUAL,
|
||||||
vimperator.modes.HINTS,
|
vimperator.modes.HINTS,
|
||||||
|
vimperator.modes.MESSAGE,
|
||||||
vimperator.modes.CARET,
|
vimperator.modes.CARET,
|
||||||
vimperator.modes.TEXTAREA];
|
vimperator.modes.TEXTAREA];
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ vimperator.modes = (function () //{{{
|
|||||||
return "-- CARET" + ext;
|
return "-- CARET" + ext;
|
||||||
case vimperator.modes.TEXTAREA:
|
case vimperator.modes.TEXTAREA:
|
||||||
return "-- TEXTAREA" + ext;
|
return "-- TEXTAREA" + ext;
|
||||||
|
case vimperator.modes.MESSAGE:
|
||||||
|
return "-- MESSAGE" + ext;
|
||||||
case vimperator.modes.CUSTOM:
|
case vimperator.modes.CUSTOM:
|
||||||
return "-- " + vimperator.plugins.mode + ext;
|
return "-- " + vimperator.plugins.mode + ext;
|
||||||
default: // NORMAL mode
|
default: // NORMAL mode
|
||||||
@@ -159,7 +161,8 @@ vimperator.modes = (function () //{{{
|
|||||||
COMMAND_LINE: 1 << 4,
|
COMMAND_LINE: 1 << 4,
|
||||||
CARET: 1 << 5, // text cursor is visible
|
CARET: 1 << 5, // text cursor is visible
|
||||||
TEXTAREA: 1 << 6, // text cursor is in a HTMLTextAreaElement
|
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
|
// extended modes, can include multiple modes, and even main modes
|
||||||
EX: 1 << 10,
|
EX: 1 << 10,
|
||||||
INPUT_MULTILINE: 1 << 11,
|
INPUT_MULTILINE: 1 << 11,
|
||||||
@@ -177,7 +180,7 @@ vimperator.modes = (function () //{{{
|
|||||||
__iterator__: function ()
|
__iterator__: function ()
|
||||||
{
|
{
|
||||||
var modes = [this.NONE, this.NORMAL, this.INSERT, this.VISUAL, this.HINTS,
|
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++)
|
for (var i = 0; i < modes.length; i++)
|
||||||
yield modes[i];
|
yield modes[i];
|
||||||
|
|||||||
@@ -78,16 +78,16 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
|||||||
</keyset>
|
</keyset>
|
||||||
|
|
||||||
<statusbar id="status-bar" class="hl-StatusLine">
|
<statusbar id="status-bar" class="hl-StatusLine">
|
||||||
<hbox insertbefore="statusText" id="vimperator-statusline" flex="1" height="10" hidden="false" align="center">
|
<hbox insertafter="statusTextBox" 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"/>
|
<statusbarpanel class="plain" id="vimperator-statusline-field-url" readonly="false" flex="1" crop="end"/>
|
||||||
<label class="plain" id="vimperator-statusline-field-inputbuffer" flex="0"/>
|
<statusbarpanel class="plain" id="vimperator-statusline-field-inputbuffer" flex="0"/>
|
||||||
<label class="plain" id="vimperator-statusline-field-progress" flex="0"/>
|
<statusbarpanel class="plain" id="vimperator-statusline-field-progress" flex="0"/>
|
||||||
<label class="plain" id="vimperator-statusline-field-tabcount" flex="0"/>
|
<statusbarpanel class="plain" id="vimperator-statusline-field-tabcount" flex="0"/>
|
||||||
<label class="plain" id="vimperator-statusline-field-bufferposition" flex="0"/>
|
<statusbarpanel class="plain" id="vimperator-statusline-field-bufferposition" flex="0"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
<!-- just hide them since other elements expect them -->
|
<!-- just hide them since other elements expect them -->
|
||||||
<statusbarpanel id="statusbar-display" hidden="true"/>
|
<statusbarpanel id="statusText" hidden="true"/>
|
||||||
<statusbarpanel id="statusbar-progresspanel" hidden="true"/>
|
<statusbarpanel id="statusbarpanel-progress" hidden="true"/>
|
||||||
</statusbar>
|
</statusbar>
|
||||||
|
|
||||||
<vbox id="vimperator-container" hidden="false">
|
<vbox id="vimperator-container" hidden="false">
|
||||||
|
|||||||
@@ -164,7 +164,8 @@ const vimperator = (function () //{{{
|
|||||||
document.commandDispatcher.focusedElement.blur();
|
document.commandDispatcher.focusedElement.blur();
|
||||||
|
|
||||||
var elem = vimperator.config.mainWidget || content;
|
var elem = vimperator.config.mainWidget || content;
|
||||||
elem.focus();
|
if (elem != document.commandDispatcher.focusedElement)
|
||||||
|
elem.focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
// partial sixth level expression evaluation
|
// partial sixth level expression evaluation
|
||||||
|
|||||||
Reference in New Issue
Block a user