From 36ece99d3ad649daece6bf6134d784776183ebfb Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 8 Oct 2008 02:40:45 +0000 Subject: [PATCH] add c_/ command-line mappings --- content/ui.js | 28 +++++++++++++++++++++------- locale/en-US/cmdline.txt | 16 ++++++++++++++++ 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/content/ui.js b/content/ui.js index 6af34c3b..05096637 100644 --- a/content/ui.js +++ b/content/ui.js @@ -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 == "" || key == "") + else if (/^(|||||)$/.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 == "" ? 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 == "" || key == "") { diff --git a/locale/en-US/cmdline.txt b/locale/en-US/cmdline.txt index 06a79040..72c0ba12 100644 --- a/locale/en-US/cmdline.txt +++ b/locale/en-US/cmdline.txt @@ -44,6 +44,22 @@ Recall the next command-line from the history list which matches the current command-line. ________________________________________________________________________________ + +|c_| |c_| +|||| + +|||| +________________________________________________________________________________ +Recall the previous command-line from the history list. +________________________________________________________________________________ + + +|c_| |c_| +|||| + +|||| +________________________________________________________________________________ +Recall the next command-line from the history list. +________________________________________________________________________________ + section:Command-line{nbsp}completion[cmdline-completion] |c_| +