mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 20:42:27 +01:00
Allow hints in the MOW.
This commit is contained in:
@@ -157,10 +157,6 @@ liberator.Hints = function () //{{{
|
|||||||
|
|
||||||
function showHints()
|
function showHints()
|
||||||
{
|
{
|
||||||
var win = window.content;
|
|
||||||
var height = win.innerHeight;
|
|
||||||
var width = win.innerWidth;
|
|
||||||
|
|
||||||
var linkfgcolor = liberator.options["linkfgcolor"];
|
var linkfgcolor = liberator.options["linkfgcolor"];
|
||||||
var linkbgcolor = liberator.options["linkbgcolor"];
|
var linkbgcolor = liberator.options["linkbgcolor"];
|
||||||
var activelinkfgcolor = liberator.options["activelinkfgcolor"];
|
var activelinkfgcolor = liberator.options["activelinkfgcolor"];
|
||||||
@@ -180,7 +176,7 @@ liberator.Hints = function () //{{{
|
|||||||
var scrollX = doc.defaultView.scrollX;
|
var scrollX = doc.defaultView.scrollX;
|
||||||
var scrollY = doc.defaultView.scrollY;
|
var scrollY = doc.defaultView.scrollY;
|
||||||
|
|
||||||
outer:
|
inner:
|
||||||
for (var i = start; i <= end; i++)
|
for (var i = start; i <= end; i++)
|
||||||
{
|
{
|
||||||
elem = hints[i][0];
|
elem = hints[i][0];
|
||||||
@@ -197,7 +193,7 @@ liberator.Hints = function () //{{{
|
|||||||
// reset background color
|
// reset background color
|
||||||
elem.style.backgroundColor = hints[i][4];
|
elem.style.backgroundColor = hints[i][4];
|
||||||
elem.style.color = hints[i][5];
|
elem.style.color = hints[i][5];
|
||||||
continue outer;
|
continue inner;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text == "" && elem.firstChild && elem.firstChild.tagName == "IMG")
|
if (text == "" && elem.firstChild && elem.firstChild.tagName == "IMG")
|
||||||
@@ -318,7 +314,7 @@ liberator.Hints = function () //{{{
|
|||||||
var firstHref = validHints[0].getAttribute("href") || null;
|
var firstHref = validHints[0].getAttribute("href") || null;
|
||||||
if (firstHref)
|
if (firstHref)
|
||||||
{
|
{
|
||||||
if (validHints.some(function (e) { return e.getAttribute("href") != firstHref; }))
|
if (validHints.some(function (e) e.getAttribute("href") != firstHref))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (validHints.length > 1)
|
else if (validHints.length > 1)
|
||||||
@@ -374,7 +370,7 @@ liberator.Hints = function () //{{{
|
|||||||
liberator.modes.add(liberator.modes.INACTIVE_HINT);
|
liberator.modes.add(liberator.modes.INACTIVE_HINT);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
if (liberator.mode == liberator.modes.HINTS)
|
if (liberator.mode == liberator.modes.HINTS)
|
||||||
liberator.modes.reset(false);
|
liberator.modes.pop();
|
||||||
}, timeout);
|
}, timeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -638,7 +634,7 @@ liberator.Hints = function () //{{{
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
show: function (mode, minor, filter)
|
show: function (mode, minor, filter, win)
|
||||||
{
|
{
|
||||||
if (mode == liberator.modes.EXTENDED_HINT && !/^[;?asoOtbTvVwWyY]$/.test(minor))
|
if (mode == liberator.modes.EXTENDED_HINT && !/^[;?asoOtbTvVwWyY]$/.test(minor))
|
||||||
{
|
{
|
||||||
@@ -646,13 +642,13 @@ liberator.Hints = function () //{{{
|
|||||||
return;
|
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
|
submode = minor || "o"; // open is the default mode
|
||||||
hintString = filter || "";
|
hintString = filter || "";
|
||||||
hintNumber = 0;
|
hintNumber = 0;
|
||||||
canUpdate = false;
|
canUpdate = false;
|
||||||
|
|
||||||
generate();
|
generate(win);
|
||||||
|
|
||||||
// get all keys from the input queue
|
// get all keys from the input queue
|
||||||
var mt = Components.classes["@mozilla.org/thread-manager;1"]
|
var mt = Components.classes["@mozilla.org/thread-manager;1"]
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ liberator.Map.prototype = {
|
|||||||
|
|
||||||
hasName: function (name)
|
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)
|
execute: function (motion, count, argument)
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ liberator.CommandLine = function () //{{{
|
|||||||
|
|
||||||
var wildIndex = 0; // keep track how often we press <Tab> in a row
|
var wildIndex = 0; // keep track how often we press <Tab> in a row
|
||||||
var completionIndex = UNINITIALIZED;
|
var completionIndex = UNINITIALIZED;
|
||||||
|
var startHints = false; // whether we're waiting to start hints mode
|
||||||
|
|
||||||
// the containing box for the promptWidget and commandWidget
|
// the containing box for the promptWidget and commandWidget
|
||||||
var commandlineWidget = document.getElementById("liberator-commandline");
|
var commandlineWidget = document.getElementById("liberator-commandline");
|
||||||
@@ -224,6 +225,7 @@ liberator.CommandLine = function () //{{{
|
|||||||
|
|
||||||
multilineOutputWidget.contentWindow.focus();
|
multilineOutputWidget.contentWindow.focus();
|
||||||
|
|
||||||
|
startHints = false;
|
||||||
liberator.modes.push(liberator.modes.COMMAND_LINE, liberator.modes.OUTPUT_MULTILINE);
|
liberator.modes.push(liberator.modes.COMMAND_LINE, liberator.modes.OUTPUT_MULTILINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -855,6 +857,14 @@ liberator.CommandLine = function () //{{{
|
|||||||
|
|
||||||
var key = liberator.events.toString(event);
|
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)
|
switch (key)
|
||||||
{
|
{
|
||||||
case "<Esc>":
|
case "<Esc>":
|
||||||
@@ -1008,6 +1018,11 @@ liberator.CommandLine = function () //{{{
|
|||||||
closeWindow = true;
|
closeWindow = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ";":
|
||||||
|
liberator.statusline.updateInputBuffer(";");
|
||||||
|
startHints = true;
|
||||||
|
break;
|
||||||
|
|
||||||
// unmapped key
|
// unmapped key
|
||||||
default:
|
default:
|
||||||
if (!liberator.options["more"] || !isScrollable() || atEnd() || liberator.events.isCancelKey(key))
|
if (!liberator.options["more"] || !isScrollable() || atEnd() || liberator.events.isCancelKey(key))
|
||||||
|
|||||||
Reference in New Issue
Block a user