mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 11:08:09 +01:00
Some smaller hint mode tweaks and fixes.
This commit is contained in:
@@ -96,8 +96,13 @@ const Hints = Module("hints", {
|
|||||||
__reset: function () {
|
__reset: function () {
|
||||||
if (!this._usedTabKey) {
|
if (!this._usedTabKey) {
|
||||||
this._hintNumber = 0;
|
this._hintNumber = 0;
|
||||||
this._updateStatusline();
|
|
||||||
}
|
}
|
||||||
|
if (this.__continue && this._validHints.length <= 1) {
|
||||||
|
this._hintString = "";
|
||||||
|
commandline.command = this._hintString;
|
||||||
|
this._showHints();
|
||||||
|
}
|
||||||
|
this._updateStatusline();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -424,6 +429,7 @@ const Hints = Module("hints", {
|
|||||||
*/
|
*/
|
||||||
_removeHints: function (timeout, slight) {
|
_removeHints: function (timeout, slight) {
|
||||||
for (let [,{ doc: doc, start: start, end: end }] in Iterator(this._docs)) {
|
for (let [,{ doc: doc, start: start, end: end }] in Iterator(this._docs)) {
|
||||||
|
util.dump(String(doc), start, end);
|
||||||
for (let elem in util.evaluateXPath("//*[@dactyl:highlight='hints']", doc))
|
for (let elem in util.evaluateXPath("//*[@dactyl:highlight='hints']", doc))
|
||||||
elem.parentNode.removeChild(elem);
|
elem.parentNode.removeChild(elem);
|
||||||
for (let i in util.range(start, end + 1))
|
for (let i in util.range(start, end + 1))
|
||||||
@@ -476,21 +482,18 @@ const Hints = Module("hints", {
|
|||||||
let elem = this._validHints[activeIndex];
|
let elem = this._validHints[activeIndex];
|
||||||
let top = this._top;
|
let top = this._top;
|
||||||
|
|
||||||
if (this._continue) {
|
if (this._continue)
|
||||||
this.__reset();
|
this.__reset();
|
||||||
if (this._validHints.length <= 1)
|
else
|
||||||
this._showHints();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this._removeHints(timeout);
|
this._removeHints(timeout);
|
||||||
}
|
|
||||||
|
|
||||||
let n = 5;
|
let n = 5;
|
||||||
(function next() {
|
(function next() {
|
||||||
this._setClass(elem, n % 2);
|
this._setClass(elem, n % 2);
|
||||||
|
util.dump(n, String(this._top));
|
||||||
if (n--)
|
if (n--)
|
||||||
this.timeout(next, 50);
|
this.timeout(next, 50);
|
||||||
else if (!this._top)
|
else if (!this._validHints.some(function (h) h.elem == elem))
|
||||||
elem.removeAttributeNS(NS, "highlight");
|
elem.removeAttributeNS(NS, "highlight");
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
||||||
|
|||||||
@@ -816,7 +816,7 @@ Class.prototype = {
|
|||||||
*/
|
*/
|
||||||
timeout: function (callback, timeout) {
|
timeout: function (callback, timeout) {
|
||||||
const self = this;
|
const self = this;
|
||||||
let notify = { notify: function notify(timer) { callback.apply(self) } };
|
let notify = { notify: function notify(timer) { try { callback.apply(self) } catch (e) { util.reportError(e) } } };
|
||||||
let timer = services.create("timer");
|
let timer = services.create("timer");
|
||||||
timer.initWithCallback(notify, timeout || 0, timer.TYPE_ONE_SHOT);
|
timer.initWithCallback(notify, timeout || 0, timer.TYPE_ONE_SHOT);
|
||||||
return timer;
|
return timer;
|
||||||
|
|||||||
Reference in New Issue
Block a user