1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 18:42:27 +01:00

Allow hints in the MOW.

This commit is contained in:
Kris Maglione
2008-09-14 22:23:06 +00:00
parent caf1274df9
commit 386bfb1f20
3 changed files with 23 additions and 12 deletions

View File

@@ -157,10 +157,6 @@ liberator.Hints = function () //{{{
function showHints()
{
var win = window.content;
var height = win.innerHeight;
var width = win.innerWidth;
var linkfgcolor = liberator.options["linkfgcolor"];
var linkbgcolor = liberator.options["linkbgcolor"];
var activelinkfgcolor = liberator.options["activelinkfgcolor"];
@@ -180,7 +176,7 @@ liberator.Hints = function () //{{{
var scrollX = doc.defaultView.scrollX;
var scrollY = doc.defaultView.scrollY;
outer:
inner:
for (var i = start; i <= end; i++)
{
elem = hints[i][0];
@@ -197,7 +193,7 @@ liberator.Hints = function () //{{{
// reset background color
elem.style.backgroundColor = hints[i][4];
elem.style.color = hints[i][5];
continue outer;
continue inner;
}
if (text == "" && elem.firstChild && elem.firstChild.tagName == "IMG")
@@ -318,7 +314,7 @@ liberator.Hints = function () //{{{
var firstHref = validHints[0].getAttribute("href") || null;
if (firstHref)
{
if (validHints.some(function (e) { return e.getAttribute("href") != firstHref; }))
if (validHints.some(function (e) e.getAttribute("href") != firstHref))
return false;
}
else if (validHints.length > 1)
@@ -374,7 +370,7 @@ liberator.Hints = function () //{{{
liberator.modes.add(liberator.modes.INACTIVE_HINT);
setTimeout(function () {
if (liberator.mode == liberator.modes.HINTS)
liberator.modes.reset(false);
liberator.modes.pop();
}, timeout);
}
}
@@ -638,7 +634,7 @@ liberator.Hints = function () //{{{
return {
show: function (mode, minor, filter)
show: function (mode, minor, filter, win)
{
if (mode == liberator.modes.EXTENDED_HINT && !/^[;?asoOtbTvVwWyY]$/.test(minor))
{
@@ -646,13 +642,13 @@ liberator.Hints = function () //{{{
return;
}
liberator.modes.set(liberator.modes.HINTS, mode);
liberator.modes.push(liberator.modes.HINTS, mode, win != undefined);
submode = minor || "o"; // open is the default mode
hintString = filter || "";
hintNumber = 0;
canUpdate = false;
generate();
generate(win);
// get all keys from the input queue
var mt = Components.classes["@mozilla.org/thread-manager;1"]

View File

@@ -51,7 +51,7 @@ liberator.Map.prototype = {
hasName: function (name)
{
return this.names.some(function (e) { return e == name; });
return this.names.some(function (e) e == name);
},
execute: function (motion, count, argument)

View File

@@ -77,6 +77,7 @@ liberator.CommandLine = function () //{{{
var wildIndex = 0; // keep track how often we press <Tab> in a row
var completionIndex = UNINITIALIZED;
var startHints = false; // whether we're waiting to start hints mode
// the containing box for the promptWidget and commandWidget
var commandlineWidget = document.getElementById("liberator-commandline");
@@ -224,6 +225,7 @@ liberator.CommandLine = function () //{{{
multilineOutputWidget.contentWindow.focus();
startHints = false;
liberator.modes.push(liberator.modes.COMMAND_LINE, liberator.modes.OUTPUT_MULTILINE);
}
@@ -855,6 +857,14 @@ liberator.CommandLine = function () //{{{
var key = liberator.events.toString(event);
if (startHints)
{
liberator.statusline.updateInputBuffer("");
startHints = false;
liberator.hints.show(liberator.modes.EXTENDED_HINT, key, undefined, win);
return;
}
switch (key)
{
case "<Esc>":
@@ -1008,6 +1018,11 @@ liberator.CommandLine = function () //{{{
closeWindow = true;
break;
case ";":
liberator.statusline.updateInputBuffer(";");
startHints = true;
break;
// unmapped key
default:
if (!liberator.options["more"] || !isScrollable() || atEnd() || liberator.events.isCancelKey(key))