1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-16 06:15:45 +01:00

Merge default.

--HG--
branch : mode-refactoring
This commit is contained in:
Kris Maglione
2010-10-08 23:45:52 -04:00
7 changed files with 57 additions and 30 deletions

View File

@@ -479,8 +479,10 @@ const CommandLine = Module("commandline", {
this.hideCompletions();
if (!this._keepCommand || this._silent || this._quiet) {
commandline.updateMorePrompt();
this.hide();
modes.delay(function () {
this.updateMorePrompt();
this.hide();
}, this);
}
},
@@ -490,7 +492,7 @@ const CommandLine = Module("commandline", {
return this._lastCommand;
},
set command(val) {
if (this.commandVisible)
if (this.commandVisible && (modes.extended & modes.EX))
return this.widgets.command = val;
return this._lastCommand = val;
},

View File

@@ -232,9 +232,13 @@
<xsl:variable name="type" select="preceding-sibling::dactyl:type[1] | following-sibling::dactyl:type[1]"/>
<span dactyl:highlight="HelpDefault">(default:<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="starts-with($type, 'string') or starts-with($type, 'regex')">
<xsl:when test="$type = 'string'">
<span dactyl:highlight="HelpString"><xsl:apply-templates mode="help-1"/></span>
</xsl:when>
<xsl:when test="contains($type, 'list') or contains($type, 'map')">
<span dactyl:highlight="HelpString" delim=""><xsl:apply-templates mode="help-1"/></span>
<xsl:if test=". = ''">(empty)</xsl:if>
</xsl:when>
<xsl:otherwise>
<span>
<xsl:attribute name="dactyl:highlight">

View File

@@ -72,7 +72,14 @@ const Hints = Module("hints", {
_reset: function (slight) {
if (!slight) {
this.__reset();
this.prevInput = "";
this.escNumbers = false;
this._usedTabKey = false;
this._canUpdate = false;
this._hintNumber = 0;
this._hintString = "";
statusline.updateInputBuffer("");
commandline.command = "";
}
this._pageHints = [];
this._validHints = [];
@@ -83,13 +90,8 @@ const Hints = Module("hints", {
this._activeTimeout = null;
},
__reset: function () {
statusline.updateInputBuffer("");
this._hintString = "";
this._hintNumber = 0;
this._usedTabKey = false;
this.prevInput = "";
this.escNumbers = false;
commandline.command = "";
if (!this._usedTabKey)
this._hintNumber = 0;
},
/**
@@ -478,7 +480,8 @@ const Hints = Module("hints", {
let top = this._top;
if (this._continue) {
this.__reset();
this._showHints();
if (this._validHints.length <= 1)
this._showHints();
}
else {
this._removeHints(timeout);
@@ -491,7 +494,8 @@ const Hints = Module("hints", {
if ((modes.extended & modes.HINTS) && !this._continue)
modes.pop();
commandline._lastEcho = null; // Hack.
this._hintMode.action(elem, elem.href || "", this._extendedhintCount, top);
this._hintMode.action(elem, elem.href || elem.src || "",
this._extendedhintCount, top);
}, timeout);
return true;
},
@@ -764,7 +768,10 @@ const Hints = Module("hints", {
commandline.input(this._hintMode.prompt + ": ", null, {
extended: modes.HINTS,
leave: function () { hints.hide(); },
leave: function (stack) {
if (!stack.push)
hints.hide();
},
onChange: this.closure._onInput
});
modes.extended = modes.HINTS;
@@ -1078,7 +1085,9 @@ const Hints = Module("hints", {
options.add(["extendedhinttags", "eht"],
"XPath string of hintable elements activated by ';'",
"regexmap", "[iI]:" + Option.quote(util.makeXPath(["img"])),
"regexmap", "[iI]:" + Option.quote(util.makeXPath(["img"])) +
",[OTivVWy]:" + Option.quote(util.makeXPath(
["{a,area}[@href]", "{img,iframe}[@src]"])),
{ validator: Option.validateXPath });
options.add(["hinttags", "ht"],

View File

@@ -185,6 +185,9 @@ const Modes = Module("modes", {
this.show();
},
delayed: [],
delay: function (callback, self) { this.delayed.push([callback, self]) },
save: function (id, obj, prop) {
if (!(id in this.boundProperties))
for (let elem in values(this._modeStack))
@@ -226,9 +229,18 @@ const Modes = Module("modes", {
}
}
this.delayed.forEach(function ([fn, self]) fn.call(self));
this.delayed = [];
let prev = stack && stack.pop || this.topOfStack;
if (push)
this._modeStack.push(push);
if (stack && stack.pop) {
for (let [k, { obj, prop, value }] in Iterator(this.topOfStack.saved))
obj[prop] = value;
}
if (this.topOfStack.params.enter && prev)
this.topOfStack.params.enter(push ? { push: push } : stack || {},
prev);
@@ -244,10 +256,8 @@ const Modes = Module("modes", {
pop: function (mode) {
while (this._modeStack.length > 1 && this.main != mode) {
let a = this._modeStack.pop();
this.set(this.topOfStack.main, this.topOfStack.extended, this.topOfStack.params, { pop: a });
for (let [k, { obj, prop, value }] in Iterator(this.topOfStack.saved))
obj[prop] = value;
this.set(this.topOfStack.main, this.topOfStack.extended, this.topOfStack.params,
{ pop: a });
if (mode == null)
return;