1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 21:37:57 +01:00

Show status of radio/checkbox elements in hint label.

This commit is contained in:
Kris Maglione
2010-10-20 05:07:45 -04:00
parent 88b491ca44
commit af8098bac6
3 changed files with 18 additions and 9 deletions

View File

@@ -16,7 +16,7 @@ const RangeFinder = Module("rangefinder", {
let backwards = mode == modes.FIND_BACKWARD; let backwards = mode == modes.FIND_BACKWARD;
commandline.open(backwards ? "?" : "/", "", mode); commandline.open(backwards ? "?" : "/", "", mode);
if (this.rangeFind && this.rangeFind.window.get() == window) if (this.rangeFind && this.rangeFind.window.get() === window)
this.rangeFind.reset(); this.rangeFind.reset();
this.find("", backwards); this.find("", backwards);
}, },
@@ -127,9 +127,8 @@ const RangeFinder = Module("rangefinder", {
set rangeFind(val) buffer.localStore.rangeFind = val, set rangeFind(val) buffer.localStore.rangeFind = val,
/** /**
* Highlights all occurrences of <b>str</b> in the buffer. * Highlights all occurrences of the last searched for string in the
* * current buffer.
* @param {string} str The string to highlight.
*/ */
highlight: function () { highlight: function () {
if (this.rangeFind) if (this.rangeFind)
@@ -157,7 +156,6 @@ const RangeFinder = Module("rangefinder", {
commandline.registerCallback("change", modes.FIND_BACKWARD, this.closure.onKeyPress); commandline.registerCallback("change", modes.FIND_BACKWARD, this.closure.onKeyPress);
commandline.registerCallback("submit", modes.FIND_BACKWARD, this.closure.onSubmit); commandline.registerCallback("submit", modes.FIND_BACKWARD, this.closure.onSubmit);
commandline.registerCallback("cancel", modes.FIND_BACKWARD, this.closure.onCancel); commandline.registerCallback("cancel", modes.FIND_BACKWARD, this.closure.onCancel);
}, },
commands: function () { commands: function () {
commands.add(["noh[lsearch]"], commands.add(["noh[lsearch]"],
@@ -321,7 +319,7 @@ const RangeFind = Class("RangeFind", {
let doc = range.startContainer.ownerDocument; let doc = range.startContainer.ownerDocument;
let win = doc.defaultView; let win = doc.defaultView;
let ranges = this.ranges.filter(function (r) let ranges = this.ranges.filter(function (r)
r.window == win && RangeFind.contains(r.range, range)); r.window === win && RangeFind.contains(r.range, range));
if (this.backward) if (this.backward)
return ranges[ranges.length - 1]; return ranges[ranges.length - 1];

View File

@@ -414,7 +414,14 @@ const Hints = Module("hints", {
} }
let str = this.getHintString(hintnum); let str = this.getHintString(hintnum);
hint.span.setAttribute("number", hint.showText ? str + ": " + hint.text.substr(0, 50) : str); let prefix = "";
if (hint.elem instanceof HTMLInputElement)
if (hint.elem.type === "radio")
prefix = hint.elem.checked ? "⊙ " : "○ ";
else if (hint.elem.type === "checkbox")
prefix = hint.elem.checked ? "☑ " : "☐ ";
hint.span.setAttribute("number", str + (hint.showText ? ": " + prefix + hint.text.substr(0, 50) : ""));
if (hint.imgSpan) if (hint.imgSpan)
hint.imgSpan.setAttribute("number", str); hint.imgSpan.setAttribute("number", str);
else else
@@ -521,6 +528,8 @@ const Hints = Module("hints", {
dactyl.trapErrors(this._hintMode.action, this._hintMode, dactyl.trapErrors(this._hintMode.action, this._hintMode,
elem, elem.href || elem.src || "", elem, elem.href || elem.src || "",
this._extendedhintCount, top); this._extendedhintCount, top);
if (this._continue && this._top)
this._showHints();
}, timeout); }, timeout);
return true; return true;
}, },

View File

@@ -324,16 +324,18 @@
<item> <item>
<tags>D</tags> <tags>D</tags>
<strut/>
<spec><oa>count</oa>D</spec> <spec><oa>count</oa>D</spec>
<description short="true"> <description>
<p>Like <k>d</k> but selects the tab to the left of the deleted tabs after deletion.</p> <p>Like <k>d</k> but selects the tab to the left of the deleted tabs after deletion.</p>
</description> </description>
</item> </item>
<item> <item>
<tags>:tabo :tabonly</tags> <tags>:tabo :tabonly</tags>
<strut/>
<spec>:tabo<oa>nly</oa></spec> <spec>:tabo<oa>nly</oa></spec>
<description short="true"> <description>
<p>Close all buffers other than the currently visible tab.</p> <p>Close all buffers other than the currently visible tab.</p>
</description> </description>
</item> </item>