1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 23:32:26 +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(); this.hideCompletions();
if (!this._keepCommand || this._silent || this._quiet) { if (!this._keepCommand || this._silent || this._quiet) {
commandline.updateMorePrompt(); modes.delay(function () {
this.hide(); this.updateMorePrompt();
this.hide();
}, this);
} }
}, },
@@ -490,7 +492,7 @@ const CommandLine = Module("commandline", {
return this._lastCommand; return this._lastCommand;
}, },
set command(val) { set command(val) {
if (this.commandVisible) if (this.commandVisible && (modes.extended & modes.EX))
return this.widgets.command = val; return this.widgets.command = val;
return this._lastCommand = 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]"/> <xsl:variable name="type" select="preceding-sibling::dactyl:type[1] | following-sibling::dactyl:type[1]"/>
<span dactyl:highlight="HelpDefault">(default:<xsl:text> </xsl:text> <span dactyl:highlight="HelpDefault">(default:<xsl:text> </xsl:text>
<xsl:choose> <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> <span dactyl:highlight="HelpString"><xsl:apply-templates mode="help-1"/></span>
</xsl:when> </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> <xsl:otherwise>
<span> <span>
<xsl:attribute name="dactyl:highlight"> <xsl:attribute name="dactyl:highlight">

View File

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

View File

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

View File

@@ -96,13 +96,11 @@
<code><ex>:autocmd LocationChange .* js modes.passAllKeys = /(www|mail)\.google\.com/.test(buffer.URL)</ex></code> <code><ex>:autocmd LocationChange .* js modes.passAllKeys = /(www|mail)\.google\.com/.test(buffer.URL)</ex></code>
<p> <p>Set the filetype to mail when editing email at Gmail:</p>
Set the filetype to mail when editing email at Gmail:
</p>
<code><!-- Why is the XSLT processor mangling newlines? --> <code><!-- Why is the XSLT processor mangling newlines? -->
<ex>:autocmd LocationChange .* :set editor=<str>gvim -f</str></ex> <ex>:autocmd LocationChange !'mail\.google\.com'</ex> <ex>:set editor=<str>gvim -f</str></ex>
<ex>:autocmd LocationChange 'mail\.google\.com' :set editor=<str>gvim -f -c 'set ft=mail'</str></ex> <ex>:autocmd LocationChange 'mail\.google\.com'</ex> <ex>:set editor=<str>gvim -f -c 'set ft=mail'</str></ex>
</code> </code>
</document> </document>

View File

@@ -320,7 +320,7 @@
<spec>'activate' 'act'</spec> <spec>'activate' 'act'</spec>
<type>stringlist</type> <type>stringlist</type>
<default>addons,downloads,extoptions,help, <default>addons,downloads,extoptions,help,
homepage,quickmark,tabopen,paste</default> homepage,quickmark,tabopen,paste</default>
<description> <description>
<p> <p>
A list of items which, when opened in a new tab, are A list of items which, when opened in a new tab, are
@@ -556,7 +556,11 @@
<spec>'extendedhinttags' 'eht'</spec> <spec>'extendedhinttags' 'eht'</spec>
<strut/> <strut/>
<type>regexmap</type> <type>regexmap</type>
<default>[iI]:'//img | //xhtml:img'</default> <default>[iI]:'//img | //xhtml:img',
[OTivVWy]:'//a[@href] | //xhtml:a[@href] |
//area[@href] | //xhtml:area[@href] |
//img[@src] | //xhtml:img[@src] |
//iframe[@src] | //xhtml:iframe[@src]'</default>
<description> <description>
<p> <p>
Defines specialized XPath expressions for arbitrary Defines specialized XPath expressions for arbitrary
@@ -891,7 +895,7 @@
<tags>'noloadplugins' 'loadplugins'</tags> <tags>'noloadplugins' 'loadplugins'</tags>
<spec>'loadplugins' 'lpl'</spec> <spec>'loadplugins' 'lpl'</spec>
<type>regexlist</type> <type>regexlist</type>
<default>\.(js|&dactyl.fileExt;)$</default> <default>'\.(js|&dactyl.fileExt;)$'</default>
<description> <description>
<p> <p>
A regular expression list that defines which plugins are loaded at A regular expression list that defines which plugins are loaded at
@@ -1000,7 +1004,7 @@
<tags>'nextpattern'</tags> <tags>'nextpattern'</tags>
<spec>'nextpattern'</spec> <spec>'nextpattern'</spec>
<type>stringlist</type> <type>stringlist</type>
<default>\bnext,^>$,^(>>|»)$,^(>|»),(>|»)$,\bmore\b</default> <default>'\bnext',^>$,'^(>>|»)$','^(>|»)','(>|»)$','\bmore\b'</default>
<description> <description>
<p> <p>
Patterns to use when guessing the next page in a document Patterns to use when guessing the next page in a document
@@ -1393,7 +1397,7 @@
<tags>'wia' 'wildanchor'</tags> <tags>'wia' 'wildanchor'</tags>
<spec>'wildanchor' 'wia'</spec> <spec>'wildanchor' 'wia'</spec>
<type>regexlist</type> <type>regexlist</type>
<default>!/ex/(back|buffer|ext|forward|help|undo)</default> <default>!'/ex/(back|buffer|ext|forward|help|undo)'</default>
<description> <description>
<p> <p>
Regular expression list defining which completion groups show only Regular expression list defining which completion groups show only

View File

@@ -244,7 +244,7 @@ const Util = Module("Util", {
let stack = Error().stack.replace(/(?:.*\n){2}/, ""); let stack = Error().stack.replace(/(?:.*\n){2}/, "");
if (frames != null) if (frames != null)
[stack] = stack.match(RegExp("(?:.*\n){0," + frames + "}")); [stack] = stack.match(RegExp("(?:.*\n){0," + frames + "}"));
util.dump((msg || "Stack") + "\n" + stack + "\n"); util.dump((arguments.length == 0 ? "Stack" : msg) + "\n" + stack + "\n");
}, },
/** /**