mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 09:17:59 +01:00
moved hints to commandline.input(), thanks Xie&Tian
This commit is contained in:
1
AUTHORS
1
AUTHORS
@@ -13,6 +13,7 @@ Inactive/former developers:
|
|||||||
* Marco Candrian (mac@calmar.ws)
|
* Marco Candrian (mac@calmar.ws)
|
||||||
|
|
||||||
Patches (in no special order):
|
Patches (in no special order):
|
||||||
|
* Xie&Tian (multibyte support for hints)
|
||||||
* Juergen Descher
|
* Juergen Descher
|
||||||
* Kazuo (count support for ctrl-^)
|
* Kazuo (count support for ctrl-^)
|
||||||
* Daniel Schaffrath (;b support)
|
* Daniel Schaffrath (;b support)
|
||||||
|
|||||||
3
NEWS
3
NEWS
@@ -1,5 +1,7 @@
|
|||||||
2008-XX-XX:
|
2008-XX-XX:
|
||||||
* version 2.0 (probably)
|
* version 2.0 (probably)
|
||||||
|
* IMPORTANT: AlwaysHint modes were removed as they didn't make too
|
||||||
|
much sense with the new hint system
|
||||||
* IMPORTANT: command actions now take an args object, returned from
|
* IMPORTANT: command actions now take an args object, returned from
|
||||||
commands.parseArgs, as their first argument. This will break any commands
|
commands.parseArgs, as their first argument. This will break any commands
|
||||||
not using the args parser explicitly. The old string value is now
|
not using the args parser explicitly. The old string value is now
|
||||||
@@ -10,6 +12,7 @@
|
|||||||
special versions for the old behavior
|
special versions for the old behavior
|
||||||
* IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and
|
* IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and
|
||||||
VimperatorLeave respectively
|
VimperatorLeave respectively
|
||||||
|
* multibyte support for hints (thanks Xie&Tian)
|
||||||
* add 'exrc'
|
* add 'exrc'
|
||||||
* add 'errorbells'
|
* add 'errorbells'
|
||||||
* add shell command completion for :!
|
* add shell command completion for :!
|
||||||
|
|||||||
@@ -1215,8 +1215,7 @@ function Events() //{{{
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (!(modes.extended & modes.INACTIVE_HINT) &&
|
else if (!mappings.hasMap(liberator.mode, input.buffer + key))
|
||||||
!mappings.hasMap(liberator.mode, input.buffer + key))
|
|
||||||
{
|
{
|
||||||
macros.set(currentMacro, macros.get(currentMacro) + key);
|
macros.set(currentMacro, macros.get(currentMacro) + key);
|
||||||
}
|
}
|
||||||
@@ -1320,13 +1319,23 @@ function Events() //{{{
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// if Hint mode is on, special handling of keys is required
|
|
||||||
if (liberator.mode == modes.HINTS)
|
if (modes.extended & modes.HINTS)
|
||||||
{
|
{
|
||||||
hints.onEvent(event);
|
// under HINT mode, certain keys are redirected to hints.onEvent
|
||||||
event.preventDefault();
|
if (key == "<Return>" || key == "<Tab>" || key == "<S-Tab>"
|
||||||
event.stopPropagation();
|
|| key == mappings.getMapLeader()
|
||||||
return false;
|
|| (key == "<BS>" && hints.previnput == "number")
|
||||||
|
|| (/^[0-9]$/.test(key) && !hints.escNumbers))
|
||||||
|
{
|
||||||
|
hints.onEvent(event);
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// others are left to generate the 'input' event or handled by firefox
|
||||||
|
return ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
167
content/hints.js
167
content/hints.js
@@ -38,6 +38,7 @@ function Hints() //{{{
|
|||||||
var hintString = ""; // the typed string part of the hint is in this string
|
var hintString = ""; // the typed string part of the hint is in this string
|
||||||
var hintNumber = 0; // only the numerical part of the hint
|
var hintNumber = 0; // only the numerical part of the hint
|
||||||
var usedTabKey = false; // when we used <Tab> to select an element
|
var usedTabKey = false; // when we used <Tab> to select an element
|
||||||
|
var prevInput = ""; // record previous user input type, "text" || "number"
|
||||||
|
|
||||||
// hints[] = [elem, text, span, imgspan, elem.style.backgroundColor, elem.style.color]
|
// hints[] = [elem, text, span, imgspan, elem.style.backgroundColor, elem.style.color]
|
||||||
var pageHints = [];
|
var pageHints = [];
|
||||||
@@ -50,6 +51,23 @@ function Hints() //{{{
|
|||||||
// keep track of the documents which we generated the hints for
|
// keep track of the documents which we generated the hints for
|
||||||
// docs = { doc: document, start: start_index in hints[], end: end_index in hints[] }
|
// docs = { doc: document, start: start_index in hints[], end: end_index in hints[] }
|
||||||
var docs = [];
|
var docs = [];
|
||||||
|
|
||||||
|
const hintDescriptions = {
|
||||||
|
a: "Save hint with prompt:",
|
||||||
|
s: "Save hint:",
|
||||||
|
o: "Follow hint:",
|
||||||
|
t: "Follow hint in a new tab:",
|
||||||
|
b: "Follow hint in a background tab:",
|
||||||
|
O: "Open location based on hint:",
|
||||||
|
T: "Open new tab based on hint:",
|
||||||
|
v: "View hint source:",
|
||||||
|
w: "Follow hint in a new window:",
|
||||||
|
W: "Open new window based on hint:",
|
||||||
|
y: "Yank hint location:",
|
||||||
|
Y: "Yank hint description:"
|
||||||
|
}
|
||||||
|
hintDescriptions[";"] = "Focus hint:";
|
||||||
|
hintDescriptions["?"] = "Show information for hint:";
|
||||||
|
|
||||||
// reset all important variables
|
// reset all important variables
|
||||||
function reset()
|
function reset()
|
||||||
@@ -58,6 +76,7 @@ function Hints() //{{{
|
|||||||
hintString = "";
|
hintString = "";
|
||||||
hintNumber = 0;
|
hintNumber = 0;
|
||||||
usedTabKey = false;
|
usedTabKey = false;
|
||||||
|
prevInput = "";
|
||||||
pageHints = [];
|
pageHints = [];
|
||||||
validHints = [];
|
validHints = [];
|
||||||
canUpdate = false;
|
canUpdate = false;
|
||||||
@@ -71,9 +90,7 @@ function Hints() //{{{
|
|||||||
|
|
||||||
function updateStatusline()
|
function updateStatusline()
|
||||||
{
|
{
|
||||||
statusline.updateInputBuffer((escapeNumbers ? mappings.getMapLeader() + " " : "") + // sign for escapeNumbers
|
statusline.updateInputBuffer((escapeNumbers ? mappings.getMapLeader() : "") + (hintNumber || ""));
|
||||||
(hintString ? "\"" + hintString + "\"" : "") +
|
|
||||||
(hintNumber > 0 ? " <" + hintNumber + ">" : ""));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function generate(win)
|
function generate(win)
|
||||||
@@ -162,7 +179,7 @@ function Hints() //{{{
|
|||||||
|
|
||||||
var elem, tagname, text, rect, span, imgspan;
|
var elem, tagname, text, rect, span, imgspan;
|
||||||
var hintnum = 1;
|
var hintnum = 1;
|
||||||
var validHint = hintMatcher(hintString);
|
var validHint = hintMatcher(hintString.toLowerCase());
|
||||||
var activeHint = hintNumber || 1;
|
var activeHint = hintNumber || 1;
|
||||||
validHints = [];
|
validHints = [];
|
||||||
|
|
||||||
@@ -325,55 +342,64 @@ function Hints() //{{{
|
|||||||
switch (submode)
|
switch (submode)
|
||||||
{
|
{
|
||||||
case ";": buffer.focusElement(elem); break;
|
case ";": buffer.focusElement(elem); break;
|
||||||
case "?": buffer.showElementInfo(elem); break;
|
|
||||||
case "a": buffer.saveLink(elem, false); break;
|
case "a": buffer.saveLink(elem, false); break;
|
||||||
case "s": buffer.saveLink(elem, true); break;
|
case "s": buffer.saveLink(elem, true); break;
|
||||||
case "o": buffer.followLink(elem, liberator.CURRENT_TAB); break;
|
case "o": buffer.followLink(elem, liberator.CURRENT_TAB); break;
|
||||||
case "O": commandline.open(":", "open " + loc, modes.EX); break;
|
|
||||||
case "t": buffer.followLink(elem, liberator.NEW_TAB); break;
|
case "t": buffer.followLink(elem, liberator.NEW_TAB); break;
|
||||||
case "b": buffer.followLink(elem, liberator.NEW_BACKGROUND_TAB); break;
|
case "b": buffer.followLink(elem, liberator.NEW_BACKGROUND_TAB); break;
|
||||||
case "T": commandline.open(":", "tabopen " + loc, modes.EX); break;
|
|
||||||
case "v": buffer.viewSource(loc, false); break;
|
case "v": buffer.viewSource(loc, false); break;
|
||||||
case "V": buffer.viewSource(loc, true); break;
|
case "V": buffer.viewSource(loc, true); break;
|
||||||
case "w": buffer.followLink(elem, liberator.NEW_WINDOW); break;
|
case "w": buffer.followLink(elem, liberator.NEW_WINDOW); break;
|
||||||
case "W": commandline.open(":", "winopen " + loc, modes.EX); break;
|
|
||||||
|
// some modes need a timeout as they depend on the command line which is still blocked
|
||||||
|
// 500ms because otherwise `fad' would delete a tab, if "a" would make an "address" link unique
|
||||||
|
case "?": setTimeout(function () { buffer.showElementInfo(elem); }, timeout + 50); break;
|
||||||
case "y": setTimeout(function () { util.copyToClipboard(loc, true); }, timeout + 50); break;
|
case "y": setTimeout(function () { util.copyToClipboard(loc, true); }, timeout + 50); break;
|
||||||
case "Y": setTimeout(function () { util.copyToClipboard(elem.textContent || "", true); }, timeout + 50); break;
|
case "Y": setTimeout(function () { util.copyToClipboard(elem.textContent || "", true); }, timeout + 50); break;
|
||||||
|
case "O": setTimeout(function () { commandline.open(":", "open " + loc, modes.EX); }, timeout); break;
|
||||||
|
case "T": setTimeout(function () { commandline.open(":", "tabopen " + loc, modes.EX); }, timeout); break;
|
||||||
|
case "W": setTimeout(function () { commandline.open(":", "winopen " + loc, modes.EX); }, timeout); break;
|
||||||
default:
|
default:
|
||||||
liberator.echoerr("INTERNAL ERROR: unknown submode: " + submode);
|
liberator.echoerr("INTERNAL ERROR: unknown submode: " + submode);
|
||||||
}
|
}
|
||||||
removeHints(timeout);
|
removeHints(timeout);
|
||||||
|
|
||||||
if (modes.extended & modes.ALWAYS_HINT)
|
if (timeout == 0 || modes.isReplaying)
|
||||||
{
|
{
|
||||||
setTimeout(function () {
|
// force a possible mode change, based on wheter an input field has focus
|
||||||
canUpdate = true;
|
events.onFocusChange();
|
||||||
hintString = "";
|
if (modes.extended & modes.HINTS)
|
||||||
hintNumber = 0;
|
modes.reset(false);
|
||||||
statusline.updateInputBuffer("");
|
|
||||||
}, timeout);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (timeout == 0 || modes.isReplaying)
|
setTimeout(function () {
|
||||||
{
|
if (modes.extended & modes.HINTS)
|
||||||
// force a possible mode change, based on wheter an input field has focus
|
modes.reset();
|
||||||
events.onFocusChange();
|
}, timeout);
|
||||||
if (liberator.mode == modes.HINTS)
|
|
||||||
modes.reset(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
modes.add(modes.INACTIVE_HINT);
|
|
||||||
setTimeout(function () {
|
|
||||||
if (liberator.mode == modes.HINTS)
|
|
||||||
modes.pop();
|
|
||||||
}, timeout);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onInput (event)
|
||||||
|
{
|
||||||
|
prevInput = "text";
|
||||||
|
|
||||||
|
// clear any timeout which might be active after pressing a number
|
||||||
|
if (activeTimeout)
|
||||||
|
{
|
||||||
|
clearTimeout(activeTimeout);
|
||||||
|
activeTimeout = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
hintNumber = 0;
|
||||||
|
hintString = commandline.getCommand();
|
||||||
|
updateStatusline();
|
||||||
|
showHints();
|
||||||
|
if (validHints.length == 1)
|
||||||
|
processHints(false);
|
||||||
|
}
|
||||||
|
|
||||||
function hintMatcher(hintString) //{{{
|
function hintMatcher(hintString) //{{{
|
||||||
{
|
{
|
||||||
@@ -599,22 +625,33 @@ function Hints() //{{{
|
|||||||
|
|
||||||
mappings.add(myModes, ["f"],
|
mappings.add(myModes, ["f"],
|
||||||
"Start QuickHint mode",
|
"Start QuickHint mode",
|
||||||
function () { hints.show(modes.QUICK_HINT); });
|
function ()
|
||||||
|
{
|
||||||
|
commandline.input("Follow hint:", null, { onChange: onInput });
|
||||||
|
modes.extended = modes.HINTS | modes.QUICK_HINT;
|
||||||
|
hints.show(modes.QUICK_HINT);
|
||||||
|
});
|
||||||
|
|
||||||
mappings.add(myModes, ["F"],
|
mappings.add(myModes, ["F"],
|
||||||
"Start QuickHint mode, but open link in a new tab",
|
"Start QuickHint mode, but open link in a new tab",
|
||||||
function () { hints.show(modes.QUICK_HINT, "t"); });
|
function ()
|
||||||
|
{
|
||||||
|
commandline.input("Follow hint in a new tab:", null, { onChange: onInput });
|
||||||
|
modes.extended = modes.HINTS | modes.QUICK_HINT;
|
||||||
|
hints.show(modes.QUICK_HINT, "t");
|
||||||
|
});
|
||||||
|
|
||||||
mappings.add(myModes, [";"],
|
mappings.add(myModes, [";"],
|
||||||
"Start an extended hint mode",
|
"Start an extended hint mode",
|
||||||
function (arg)
|
function (arg)
|
||||||
{
|
{
|
||||||
if (arg == "f")
|
let prompt = hintDescriptions[arg];
|
||||||
hints.show(modes.ALWAYS_HINT, "o");
|
if (!prompt)
|
||||||
else if (arg == "F")
|
return liberator.beep();
|
||||||
hints.show(modes.ALWAYS_HINT, "t");
|
|
||||||
else
|
commandline.input(prompt, null, { onChange: onInput });
|
||||||
hints.show(modes.EXTENDED_HINT, arg);
|
modes.extended = modes.HINTS | modes.EXTENDED_HINT;
|
||||||
|
hints.show(modes.EXTENDED_HINT, arg);
|
||||||
},
|
},
|
||||||
{ flags: Mappings.flags.ARGUMENT });
|
{ flags: Mappings.flags.ARGUMENT });
|
||||||
|
|
||||||
@@ -632,10 +669,11 @@ function Hints() //{{{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
modes.push(modes.HINTS, mode, win != undefined);
|
|
||||||
submode = minor || "o"; // open is the default mode
|
submode = minor || "o"; // open is the default mode
|
||||||
hintString = filter || "";
|
hintString = filter || "";
|
||||||
hintNumber = 0;
|
hintNumber = 0;
|
||||||
|
usedTab = false;
|
||||||
|
prevInput = "";
|
||||||
canUpdate = false;
|
canUpdate = false;
|
||||||
|
|
||||||
generate(win);
|
generate(win);
|
||||||
@@ -684,11 +722,6 @@ function Hints() //{{{
|
|||||||
followFirst = true;
|
followFirst = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "<Space>":
|
|
||||||
hintString += " ";
|
|
||||||
escapeNumbers = false;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "<Tab>":
|
case "<Tab>":
|
||||||
case "<S-Tab>":
|
case "<S-Tab>":
|
||||||
usedTabKey = true;
|
usedTabKey = true;
|
||||||
@@ -707,20 +740,17 @@ function Hints() //{{{
|
|||||||
hintNumber = validHints.length;
|
hintNumber = validHints.length;
|
||||||
}
|
}
|
||||||
showActiveHint(hintNumber, oldID);
|
showActiveHint(hintNumber, oldID);
|
||||||
|
updateStatusline();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case "<BS>":
|
case "<BS>":
|
||||||
if (hintNumber > 0 && !usedTabKey)
|
if (hintNumber > 0 && !usedTabKey)
|
||||||
{
|
{
|
||||||
hintNumber = Math.floor(hintNumber / 10);
|
hintNumber = Math.floor(hintNumber / 10);
|
||||||
|
if (hintNumber == 0)
|
||||||
|
prevInput = "text";
|
||||||
}
|
}
|
||||||
else if (hintString != "")
|
else
|
||||||
{
|
|
||||||
usedTabKey = false;
|
|
||||||
hintNumber = 0;
|
|
||||||
hintString = hintString.substr(0, hintString.length - 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
usedTabKey = false;
|
usedTabKey = false;
|
||||||
hintNumber = 0;
|
hintNumber = 0;
|
||||||
@@ -729,12 +759,6 @@ function Hints() //{{{
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "<C-w>":
|
|
||||||
case "<C-u>":
|
|
||||||
hintString = "";
|
|
||||||
hintNumber = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case mappings.getMapLeader():
|
case mappings.getMapLeader():
|
||||||
escapeNumbers = !escapeNumbers;
|
escapeNumbers = !escapeNumbers;
|
||||||
if (escapeNumbers && usedTabKey) // hintNumber not used normally, but someone may wants to toggle
|
if (escapeNumbers && usedTabKey) // hintNumber not used normally, but someone may wants to toggle
|
||||||
@@ -744,23 +768,10 @@ function Hints() //{{{
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// pass any special or ctrl- etc. prefixed key back to the main liberator loop
|
if (/^[0-9]$/.test(key))
|
||||||
if (/^<./.test(key) || key == ":")
|
|
||||||
{
|
|
||||||
var map = null;
|
|
||||||
if ((map = mappings.get(modes.NORMAL, key)) ||
|
|
||||||
(map = mappings.get(modes.HINTS, key)))
|
|
||||||
{
|
|
||||||
map.execute(null, -1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
liberator.beep();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (/^[0-9]$/.test(key) && !escapeNumbers)
|
|
||||||
{
|
{
|
||||||
|
prevInput = "number";
|
||||||
|
|
||||||
var oldHintNumber = hintNumber;
|
var oldHintNumber = hintNumber;
|
||||||
if (hintNumber == 0 || usedTabKey)
|
if (hintNumber == 0 || usedTabKey)
|
||||||
{
|
{
|
||||||
@@ -802,14 +813,6 @@ function Hints() //{{{
|
|||||||
processHints(true);
|
processHints(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hintString += key;
|
|
||||||
hintNumber = 0; // after some text input
|
|
||||||
if (usedTabKey)
|
|
||||||
{
|
|
||||||
usedTabKey = false;
|
|
||||||
showActiveHint(1, hintNumber);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateStatusline();
|
updateStatusline();
|
||||||
|
|||||||
@@ -593,7 +593,7 @@ const liberator = (function () //{{{
|
|||||||
|
|
||||||
triggerCallback: function (type, mode, data)
|
triggerCallback: function (type, mode, data)
|
||||||
{
|
{
|
||||||
//liberator.dump("type: " + type + " mode: " + mode + "data: " + data + "\n");
|
// liberator.dump("type: " + type + " mode: " + mode + "data: " + data + "\n");
|
||||||
for (let i = 0; i < callbacks.length; i++)
|
for (let i = 0; i < callbacks.length; i++)
|
||||||
{
|
{
|
||||||
var [thistype, thismode, thisfunc] = callbacks[i];
|
var [thistype, thismode, thisfunc] = callbacks[i];
|
||||||
|
|||||||
@@ -54,10 +54,6 @@ const modes = (function () //{{{
|
|||||||
ext += " (quick)";
|
ext += " (quick)";
|
||||||
if (extended & modes.EXTENDED_HINT)
|
if (extended & modes.EXTENDED_HINT)
|
||||||
ext += " (extended)";
|
ext += " (extended)";
|
||||||
if (extended & modes.ALWAYS_HINT)
|
|
||||||
ext += " (always)";
|
|
||||||
if (extended & modes.INACTIVE_HINT)
|
|
||||||
ext += " (inactive)";
|
|
||||||
if (extended & modes.MENU) // TODO: desirable?
|
if (extended & modes.MENU) // TODO: desirable?
|
||||||
ext += " (menu)";
|
ext += " (menu)";
|
||||||
|
|
||||||
@@ -76,8 +72,12 @@ const modes = (function () //{{{
|
|||||||
return "-- INSERT" + ext;
|
return "-- INSERT" + ext;
|
||||||
case modes.VISUAL:
|
case modes.VISUAL:
|
||||||
return (extended & modes.LINE) ? "-- VISUAL LINE" + ext : "-- VISUAL" + ext;
|
return (extended & modes.LINE) ? "-- VISUAL LINE" + ext : "-- VISUAL" + ext;
|
||||||
case modes.HINTS:
|
// under modes.COMMAND_LINE, this block will never be reached
|
||||||
return "-- HINTS" + ext;
|
case modes.COMMAND_LINE: // since modes.HINTS is actually not a main mode
|
||||||
|
if (extended & modes.HINTS)
|
||||||
|
return "-- HINTS" + ext;
|
||||||
|
else
|
||||||
|
return macromode;
|
||||||
case modes.CARET:
|
case modes.CARET:
|
||||||
return "-- CARET" + ext;
|
return "-- CARET" + ext;
|
||||||
case modes.TEXTAREA:
|
case modes.TEXTAREA:
|
||||||
@@ -129,11 +129,10 @@ const modes = (function () //{{{
|
|||||||
plugins.stop();
|
plugins.stop();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case modes.HINTS:
|
|
||||||
hints.hide();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case modes.COMMAND_LINE:
|
case modes.COMMAND_LINE:
|
||||||
|
// clean up for HINT mode
|
||||||
|
if (modes.extended & modes.HINTS)
|
||||||
|
hints.hide();
|
||||||
commandline.close();
|
commandline.close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -176,12 +175,10 @@ const modes = (function () //{{{
|
|||||||
SEARCH_BACKWARD: 1 << 14,
|
SEARCH_BACKWARD: 1 << 14,
|
||||||
QUICK_HINT: 1 << 15,
|
QUICK_HINT: 1 << 15,
|
||||||
EXTENDED_HINT: 1 << 16,
|
EXTENDED_HINT: 1 << 16,
|
||||||
ALWAYS_HINT: 1 << 17,
|
MENU: 1 << 17, // a popupmenu is active
|
||||||
INACTIVE_HINT: 1 << 18, // a short time after following a hint, we do not accept any input
|
LINE: 1 << 18, // linewise visual mode
|
||||||
MENU: 1 << 19, // a popupmenu is active
|
RECORDING: 1 << 19,
|
||||||
LINE: 1 << 20, // linewise visual mode
|
PROMPT: 1 << 20,
|
||||||
RECORDING: 1 << 21,
|
|
||||||
PROMPT: 1 << 22,
|
|
||||||
|
|
||||||
__iterator__: function () util.Array.iterator(this.all),
|
__iterator__: function () util.Array.iterator(this.all),
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,8 @@ function CommandLine() //{{{
|
|||||||
var multilineCallback = null;
|
var multilineCallback = null;
|
||||||
|
|
||||||
// callback for prompt mode
|
// callback for prompt mode
|
||||||
var promptCallback = null;
|
var promptSubmitCallback = null;
|
||||||
|
var promptChangeCallback = null;
|
||||||
var promptCompleter = null;
|
var promptCompleter = null;
|
||||||
|
|
||||||
liberator.registerCallback("change", modes.EX, function (command) {
|
liberator.registerCallback("change", modes.EX, function (command) {
|
||||||
@@ -160,8 +161,8 @@ function CommandLine() //{{{
|
|||||||
|
|
||||||
function closePrompt(value)
|
function closePrompt(value)
|
||||||
{
|
{
|
||||||
let callback = promptCallback;
|
let callback = promptSubmitCallback;
|
||||||
promptCallback = null;
|
promptSubmitCallback = null;
|
||||||
currentExtendedMode = null;
|
currentExtendedMode = null;
|
||||||
commandline.clear();
|
commandline.clear();
|
||||||
if (callback)
|
if (callback)
|
||||||
@@ -169,6 +170,8 @@ function CommandLine() //{{{
|
|||||||
}
|
}
|
||||||
liberator.registerCallback("cancel", modes.PROMPT, closePrompt);
|
liberator.registerCallback("cancel", modes.PROMPT, closePrompt);
|
||||||
liberator.registerCallback("submit", modes.PROMPT, closePrompt);
|
liberator.registerCallback("submit", modes.PROMPT, closePrompt);
|
||||||
|
liberator.registerCallback("change", modes.PROMPT,
|
||||||
|
function (str) { if (promptChangeCallback) return promptChangeCallback(str); });
|
||||||
liberator.registerCallback("complete", modes.PROMPT,
|
liberator.registerCallback("complete", modes.PROMPT,
|
||||||
function (str) { if (promptCompleter) return promptCompleter(str); });
|
function (str) { if (promptCompleter) return promptCompleter(str); });
|
||||||
|
|
||||||
@@ -665,7 +668,8 @@ function CommandLine() //{{{
|
|||||||
{
|
{
|
||||||
extra = extra || {};
|
extra = extra || {};
|
||||||
|
|
||||||
promptCallback = callback;
|
promptSubmitCallback = callback;
|
||||||
|
promptChangeCallback = extra.onChange;
|
||||||
promptCompleter = extra.completer;
|
promptCompleter = extra.completer;
|
||||||
modes.push(modes.COMMAND_LINE, modes.PROMPT);
|
modes.push(modes.COMMAND_LINE, modes.PROMPT);
|
||||||
currentExtendedMode = modes.PROMPT;
|
currentExtendedMode = modes.PROMPT;
|
||||||
|
|||||||
@@ -52,15 +52,8 @@ this hint mode. Then press [a]24[a] to copy the hint location.
|
|||||||
* [m]y[m] to yank its destination location
|
* [m]y[m] to yank its destination location
|
||||||
* [m]Y[m] to yank its text description
|
* [m]Y[m] to yank its text description
|
||||||
|
|
||||||
Additionally there are two {mode}s, which will start an AlwaysHint mode:
|
Hintable elements for all extended hint modes can be set in the
|
||||||
|
'extendedhinttags' XPath string.
|
||||||
* [m]f[m] to open its location in the current tab
|
|
||||||
* [m]F[m] to open its location in a new tab
|
|
||||||
|
|
||||||
These work like the [m]f[m] or [m]F[m] mappings but will keep you in
|
|
||||||
AlwaysHint mode. This is useful if you want to open many links of one page
|
|
||||||
without pressing [m]f[m] or [m]F[m] each time. Hintable elements for all
|
|
||||||
extended hint modes can be set in the 'extendedhinttags' XPath string.
|
|
||||||
________________________________________________________________________________
|
________________________________________________________________________________
|
||||||
|
|
||||||
// vim: set syntax=asciidoc:
|
// vim: set syntax=asciidoc:
|
||||||
|
|||||||
Reference in New Issue
Block a user