1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 16:52:25 +01:00

add c_<PageUp>/<PageDown> command-line mappings

This commit is contained in:
Doug Kearns
2008-10-08 02:40:45 +00:00
parent cd8bae267f
commit 36ece99d3a
2 changed files with 37 additions and 7 deletions

View File

@@ -718,10 +718,18 @@ liberator.CommandLine = function () //{{{
liberator.statusline.updateProgress(""); // we may have a "match x of y" visible
return liberator.triggerCallback("submit", mode, command);
}
// user pressed UP or DOWN arrow to cycle history completion
else if (key == "<Up>" || key == "<Down>")
else if (/^(<Up>|<Down>|<S-Up>|<S-Down>|<PageUp>|<PageDown>)$/.test(key))
{
function gotoHistoryItem(index)
{
setCommand(history.get(historyIndex));
liberator.triggerCallback("change", currentExtendedMode, liberator.commandline.getCommand());
}
let previousItem = /Up/.test(key);
let matchCurrent = !/(Page|S-)/.test(key);
event.preventDefault();
event.stopPropagation();
@@ -739,7 +747,7 @@ liberator.CommandLine = function () //{{{
// commandline string
while (historyIndex >= -1 && historyIndex <= history.length)
{
key == "<Up>" ? historyIndex-- : historyIndex++;
previousItem ? historyIndex-- : historyIndex++;
// user pressed DOWN when there is no newer history item
if (historyIndex == history.length)
@@ -763,15 +771,21 @@ liberator.CommandLine = function () //{{{
break;
}
if (history.get(historyIndex).indexOf(historyStart) == 0)
if (matchCurrent)
{
setCommand(history.get(historyIndex));
liberator.triggerCallback("change", currentExtendedMode, this.getCommand());
if (history.get(historyIndex).indexOf(historyStart) == 0)
{
gotoHistoryItem(historyIndex);
break;
}
}
else
{
gotoHistoryItem(historyIndex);
break;
}
}
}
// user pressed TAB to get completions of a command
else if (key == "<Tab>" || key == "<S-Tab>")
{

View File

@@ -44,6 +44,22 @@ Recall the next command-line from the history list which matches the current
command-line.
________________________________________________________________________________
|c_<S-Up>| |c_<PageUp>|
||<S-Up>|| +
||<PageUp>||
________________________________________________________________________________
Recall the previous command-line from the history list.
________________________________________________________________________________
|c_<S-Down>| |c_<PageDown>|
||<S-Down>|| +
||<PageDown>||
________________________________________________________________________________
Recall the next command-line from the history list.
________________________________________________________________________________
section:Command-line{nbsp}completion[cmdline-completion]
|c_<Tab>| +