mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 11:18:00 +01:00
Add EMBED mode.
This commit is contained in:
@@ -488,7 +488,9 @@ function Events() //{{{
|
|||||||
let elem = liberator.focus;
|
let elem = liberator.focus;
|
||||||
return ((elem instanceof HTMLInputElement && !/image/.test(elem.type)) ||
|
return ((elem instanceof HTMLInputElement && !/image/.test(elem.type)) ||
|
||||||
elem instanceof HTMLTextAreaElement ||
|
elem instanceof HTMLTextAreaElement ||
|
||||||
elem instanceof HTMLIsIndexElement);
|
elem instanceof HTMLIsIndexElement ||
|
||||||
|
elem instanceof HTMLObjectElement ||
|
||||||
|
elem instanceof HTMLEmbedElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerLoadAutocmd(name, doc)
|
function triggerLoadAutocmd(name, doc)
|
||||||
@@ -1303,6 +1305,11 @@ function Events() //{{{
|
|||||||
buffer.lastInputField = elem;
|
buffer.lastInputField = elem;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (elem instanceof HTMLEmbedElement || elem instanceof HTMLObjectElement)
|
||||||
|
{
|
||||||
|
liberator.mode = modes.EMBED;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (elem instanceof HTMLTextAreaElement || (elem && elem.contentEditable == "true"))
|
if (elem instanceof HTMLTextAreaElement || (elem && elem.contentEditable == "true"))
|
||||||
{
|
{
|
||||||
@@ -1577,7 +1584,7 @@ function Events() //{{{
|
|||||||
if (countStr && !candidateCommand)
|
if (countStr && !candidateCommand)
|
||||||
{
|
{
|
||||||
// no count for insert mode mappings
|
// no count for insert mode mappings
|
||||||
if (liberator.mode == modes.INSERT || liberator.mode == modes.COMMAND_LINE)
|
if (!modes.mainMode.count && !modes.mainMode.input)
|
||||||
stop = false;
|
stop = false;
|
||||||
else
|
else
|
||||||
input.buffer = inputStr;
|
input.buffer = inputStr;
|
||||||
@@ -1656,7 +1663,7 @@ function Events() //{{{
|
|||||||
if (!(modes.extended & modes.INPUT_MULTILINE))
|
if (!(modes.extended & modes.INPUT_MULTILINE))
|
||||||
commandline.onEvent(event); // reroute event in command line mode
|
commandline.onEvent(event); // reroute event in command line mode
|
||||||
}
|
}
|
||||||
else if (liberator.mode != modes.INSERT && liberator.mode != modes.TEXTAREA)
|
else if (!modes.mainMode.input)
|
||||||
liberator.beep();
|
liberator.beep();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,6 +137,8 @@ const modes = (function () //{{{
|
|||||||
|
|
||||||
get mainModes() (mode for ([k, mode] in Iterator(modeMap)) if (!mode.extended && mode.name == k)),
|
get mainModes() (mode for ([k, mode] in Iterator(modeMap)) if (!mode.extended && mode.name == k)),
|
||||||
|
|
||||||
|
get mainMode() modeMap[main],
|
||||||
|
|
||||||
addMode: function (name, extended, options)
|
addMode: function (name, extended, options)
|
||||||
{
|
{
|
||||||
let disp = name.replace("_", " ", "g");
|
let disp = name.replace("_", " ", "g");
|
||||||
@@ -148,6 +150,8 @@ const modes = (function () //{{{
|
|||||||
}
|
}
|
||||||
modeMap[name] = modeMap[this[name]] = util.extend({
|
modeMap[name] = modeMap[this[name]] = util.extend({
|
||||||
extended: extended,
|
extended: extended,
|
||||||
|
count: true,
|
||||||
|
input: false,
|
||||||
mask: this[name],
|
mask: this[name],
|
||||||
name: name,
|
name: name,
|
||||||
disp: disp
|
disp: disp
|
||||||
@@ -270,11 +274,12 @@ const modes = (function () //{{{
|
|||||||
|
|
||||||
// main modes, only one should ever be active
|
// main modes, only one should ever be active
|
||||||
self.addMode("NORMAL", { char: "n", display: -1 });
|
self.addMode("NORMAL", { char: "n", display: -1 });
|
||||||
self.addMode("INSERT", { char: "i" });
|
self.addMode("INSERT", { char: "i", input: true });
|
||||||
self.addMode("VISUAL", { char: "v", display: function () "VISUAL" + (extended & modes.LINE ? " LINE" : "") });
|
self.addMode("VISUAL", { char: "v", display: function () "VISUAL" + (extended & modes.LINE ? " LINE" : "") });
|
||||||
self.addMode("COMMAND_LINE", { char: "c" });
|
self.addMode("COMMAND_LINE", { char: "c", input: true });
|
||||||
self.addMode("CARET"); // text cursor is visible
|
self.addMode("CARET"); // text cursor is visible
|
||||||
self.addMode("TEXTAREA", { char: "i" }); // text cursor is in a HTMLTextAreaElement
|
self.addMode("TEXTAREA", { char: "i", input: true }); // text cursor is in a HTMLTextAreaElement
|
||||||
|
self.addMode("EMBED", { input: true });
|
||||||
self.addMode("CUSTOM", { display: function () plugins.mode });
|
self.addMode("CUSTOM", { display: function () plugins.mode });
|
||||||
// extended modes, can include multiple modes, and even main modes
|
// extended modes, can include multiple modes, and even main modes
|
||||||
self.addMode("EX", true);
|
self.addMode("EX", true);
|
||||||
|
|||||||
Reference in New Issue
Block a user