mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 23:37:59 +01:00
Fix some errors in :command-complete-custom. Fix some help tags not appearing.
This commit is contained in:
@@ -175,7 +175,7 @@ Dactyl.prototype = {
|
|||||||
if (tag in this.FILE_MAP)
|
if (tag in this.FILE_MAP)
|
||||||
return redirect("dactyl://help/" + tag, uri);
|
return redirect("dactyl://help/" + tag, uri);
|
||||||
if (tag in this.HELP_TAGS)
|
if (tag in this.HELP_TAGS)
|
||||||
return redirect("dactyl://help/" + this.HELP_TAGS[tag] + "#" + tag, uri);
|
return redirect("dactyl://help/" + this.HELP_TAGS[tag] + "#" + tag.replace(/#/g, encodeURIComponent), uri);
|
||||||
case "locale":
|
case "locale":
|
||||||
return makeChannel(["resource://dactyl-locale", config.locale, path].join("/"), uri);
|
return makeChannel(["resource://dactyl-locale", config.locale, path].join("/"), uri);
|
||||||
case "locale-local":
|
case "locale-local":
|
||||||
|
|||||||
@@ -1103,17 +1103,8 @@ var CommandLine = Module("commandline", {
|
|||||||
if (event.type == "click" && (event.target instanceof HTMLAnchorElement ||
|
if (event.type == "click" && (event.target instanceof HTMLAnchorElement ||
|
||||||
event.originalTarget.hasAttributeNS(NS, "command"))) {
|
event.originalTarget.hasAttributeNS(NS, "command"))) {
|
||||||
|
|
||||||
let command = event.originalTarget.getAttributeNS(NS, "command");
|
if (event.getPreventDefault())
|
||||||
if (command && event.button == 2)
|
return;
|
||||||
return PASS;
|
|
||||||
|
|
||||||
if (command && dactyl.commands[command]) {
|
|
||||||
event.preventDefault();
|
|
||||||
return dactyl.withSavedValues(["forceNewTab"], function () {
|
|
||||||
dactyl.forceNewTab = event.ctrlKey || event.shiftKey || event.button == 1;
|
|
||||||
return dactyl.commands[command](event);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case "<LeftMouse>":
|
case "<LeftMouse>":
|
||||||
|
|||||||
@@ -968,6 +968,19 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onClick: function onClick(event) {
|
||||||
|
let command = event.originalTarget.getAttributeNS(NS, "command");
|
||||||
|
if (command && event.button == 0) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
if (dactyl.commands[command])
|
||||||
|
dactyl.withSavedValues(["forceNewTab"], function () {
|
||||||
|
dactyl.forceNewTab = event.ctrlKey || event.shiftKey || event.button == 1;
|
||||||
|
dactyl.commands[command](event);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens one or more URLs. Returns true when load was initiated, or
|
* Opens one or more URLs. Returns true when load was initiated, or
|
||||||
* false on error.
|
* false on error.
|
||||||
@@ -1307,6 +1320,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
events: function () {
|
||||||
|
events.addSessionListener(window, "click", dactyl.closure.onClick, true);
|
||||||
|
},
|
||||||
// Only general options are added here, which are valid for all Dactyl extensions
|
// Only general options are added here, which are valid for all Dactyl extensions
|
||||||
options: function () {
|
options: function () {
|
||||||
options.add(["errorbells", "eb"],
|
options.add(["errorbells", "eb"],
|
||||||
|
|||||||
@@ -352,6 +352,7 @@
|
|||||||
<!-- HTML-ish elements {{{1 -->
|
<!-- HTML-ish elements {{{1 -->
|
||||||
|
|
||||||
<xsl:template match="dactyl:dl" mode="help-2">
|
<xsl:template match="dactyl:dl" mode="help-2">
|
||||||
|
<xsl:apply-templates select="@tag" mode="help-1"/>
|
||||||
<dl>
|
<dl>
|
||||||
<column style="{@dt}"/>
|
<column style="{@dt}"/>
|
||||||
<column style="{@dd}"/>
|
<column style="{@dd}"/>
|
||||||
@@ -375,7 +376,11 @@
|
|||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
<xsl:if test="regexp:match(@topic, '^[a-zA-Z]*:', '')
|
<xsl:if test="regexp:match(@topic, '^[a-zA-Z]*:', '')
|
||||||
and not(starts-with(@topic, 'mailto:'))">
|
and not(starts-with(@topic, 'mailto:') or
|
||||||
|
starts-with(@topic, 'chrome:') or
|
||||||
|
starts-with(@topic, 'resource:') or
|
||||||
|
starts-with(@topic, 'dactyl:'))">
|
||||||
|
<!-- A regexp does not work for the second test here ↑. :( -->
|
||||||
<xsl:attribute name="rel">external</xsl:attribute>
|
<xsl:attribute name="rel">external</xsl:attribute>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:apply-templates select="@*|node()" mode="help-1"/>
|
<xsl:apply-templates select="@*|node()" mode="help-1"/>
|
||||||
|
|||||||
@@ -422,13 +422,14 @@ var Mappings = Module("mappings", {
|
|||||||
<td style="padding-right: 1em;">Command</td>
|
<td style="padding-right: 1em;">Command</td>
|
||||||
<td style="padding-right: 1em;">Action</td>
|
<td style="padding-right: 1em;">Action</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<col style="min-width: 6em; padding-right: 1em;"/>
|
||||||
{
|
{
|
||||||
template.map(hives, function (hive) let (i = 0)
|
template.map(hives, function (hive) let (i = 0)
|
||||||
<tr style="height: .5ex;"/> +
|
<tr style="height: .5ex;"/> +
|
||||||
template.map(maps(hive), function (map)
|
template.map(maps(hive), function (map)
|
||||||
template.map(map.names, function (name)
|
template.map(map.names, function (name)
|
||||||
<tr>
|
<tr>
|
||||||
<td highlight="Title" style="padding-right: 1em">{!i++ ? hive.name : ""}</td>
|
<td highlight="Title">{!i++ ? hive.name : ""}</td>
|
||||||
<td>{modeSign}</td>
|
<td>{modeSign}</td>
|
||||||
<td>{name}</td>
|
<td>{name}</td>
|
||||||
<td>{map.rhs || map.action.toSource()}</td>
|
<td>{map.rhs || map.action.toSource()}</td>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
name="map"
|
name="map"
|
||||||
title="&dactyl.appName; Key Mappings"
|
title="&dactyl.appName; Key Mappings"
|
||||||
xmlns="&xmlns.dactyl;"
|
xmlns="&xmlns.dactyl;"
|
||||||
|
xmlns:dactyl="&xmlns.dactyl;"
|
||||||
xmlns:html="&xmlns.html;">
|
xmlns:html="&xmlns.html;">
|
||||||
|
|
||||||
<h1 tag="keyboard-shortcuts">Keyboard shortcuts and commands</h1>
|
<h1 tag="keyboard-shortcuts">Keyboard shortcuts and commands</h1>
|
||||||
@@ -617,36 +618,42 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
Custom completion can be provided by specifying the
|
Custom completion can be provided by specifying the
|
||||||
<str>custom,<a>thing</a></str> argument to -complete. If
|
<str>custom,<a>thing</a></str> argument to <tt>-complete</tt>. If
|
||||||
<a>thing</a> evaluates to a function (i.e., it is a variable
|
<a>thing</a> evaluates to a function (i.e., it is a variable holding
|
||||||
holding a function value, or a string containing the definition
|
a function value, or a string containing the definition itself), it
|
||||||
itself), it is called with two arguments: a completion context, and
|
is called with two arguments: a completion context, and an object
|
||||||
an object describing the command's arguments. It should set the
|
describing the command's arguments. It should set the context's
|
||||||
context's <str>completions</str> property, or return an object with
|
<tt>completions</tt> property to the list of completion results.
|
||||||
<str>items</str> and <str>start</str> properties describing the
|
Other influential properties include <tt>title</tt>, <tt>sort</tt>,
|
||||||
completions and where the replacement is to start.
|
<tt>anthored</tt>, and <tt>filters</tt>, which are documented in the
|
||||||
|
<link topic="resource://dactyl/completion.jsm"
|
||||||
|
line="17" dactyl:command="buffer.viewSource">source code</link>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<em>start</em> is the index into the word being completed at which the returned values
|
<em>start</em> is the index into the word being completed at which the returned values
|
||||||
should be applied and <em>completions</em> is a two-dimensional array of the form:
|
should be applied and <em>completions</em> is a two-dimensional array of the form:
|
||||||
[[arg1, description1], [arg2, description2], …]
|
<tt>[[arg1, description1], [arg2, description2], …]</tt>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Otherwise <a>thing</a> should be an array of the same form as the
|
Otherwise <a>thing</a> should be an array of the same form as the
|
||||||
<str>completions</str> property of the context object.
|
<tt>completions</tt> property of the context object.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Example:
|
Example:
|
||||||
<code><ex>:command foo -complete custom,
|
<code><ex>:command foo -nargs=<str>?</str>
|
||||||
\ <str delim="'">function (context) context.completions = [["arg1", "description1"], ["arg2", "description2"]]</str>
|
\ -complete custom,<str delim="'">
|
||||||
\ <ex>:echo <str>Useless</str></ex></ex>
|
\ function (context) context.completions = [["arg1", "description1"], ["arg2", "description2"]]</str></ex>
|
||||||
|
\ <ex>:echo</ex> <str>Useless </str> + <em><q-args></em>
|
||||||
|
|
||||||
<ex>:command foo -complete custom,<str delim="'">[["arg1", "description1"], ["arg2, "description2"]]</str>
|
<ex>:command foo -nargs=<str>?</str>
|
||||||
\ <ex>:echo <str>Same as above but simpler</str></ex></ex>
|
\ -complete custom,<str delim="'">[
|
||||||
</code>
|
\ ["arg1", "description1"],
|
||||||
|
\ ["arg2, "description2"]
|
||||||
|
\ ]</str></ex>
|
||||||
|
\ <ex>:echo</ex> <str>Same as above but simpler </str> + <em><q-args></em></code>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3 tag="E177 E178 :command-count">Count handling</h3>
|
<h3 tag="E177 E178 :command-count">Count handling</h3>
|
||||||
|
|||||||
@@ -167,19 +167,20 @@
|
|||||||
Additionally, certain commands support the same ‘here document’
|
Additionally, certain commands support the same ‘here document’
|
||||||
syntax supported by most Unix shells and by the &tag.command-line;.
|
syntax supported by most Unix shells and by the &tag.command-line;.
|
||||||
So, to execute a JavaScript statement which does not comfortably fit
|
So, to execute a JavaScript statement which does not comfortably fit
|
||||||
on a single line, you can use
|
on a single line, you can use:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>See also <t>ex-scripts</t> below.</p>
|
|
||||||
|
|
||||||
<code><ex>:js</ex> <<<em>EOF</em>
|
<code><ex>:js</ex> <<<em>EOF</em>
|
||||||
<kwd><hl key="Object">var</hl></kwd> hello = <kwd>function</kwd> () {
|
<kwd><hl key="Object">var</hl></kwd> hello = <kwd>function</kwd> () {
|
||||||
alert(<str>Hello world</str>);
|
alert(<str>Hello world</str>);
|
||||||
}
|
}
|
||||||
<em>EOF</em></code>
|
<em>EOF</em></code>
|
||||||
|
|
||||||
|
<p>See also <t>ex-scripts</t> below.</p>
|
||||||
</description>
|
</description>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
|
||||||
<item>
|
<item>
|
||||||
<tags>:lpl :loadplugins</tags>
|
<tags>:lpl :loadplugins</tags>
|
||||||
<strut/>
|
<strut/>
|
||||||
@@ -277,8 +278,8 @@
|
|||||||
character.
|
character.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<code> <html:span style="color: #444"> " This is a comment</html:span>
|
<code> <hl style="color: #444">" This is a comment</hl>
|
||||||
foo bar <html:span style="color: #444">" This is a comment</html:span>
|
foo bar <hl style="color: #444">" This is a comment</hl>
|
||||||
<str> This is not a comment</str>
|
<str> This is not a comment</str>
|
||||||
foo bar <str> This is not a comment</str>
|
foo bar <str> This is not a comment</str>
|
||||||
</code>
|
</code>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
xmlns="&xmlns.dactyl;"
|
xmlns="&xmlns.dactyl;"
|
||||||
xmlns:html="&xmlns.html;">
|
xmlns:html="&xmlns.html;">
|
||||||
|
|
||||||
<dl tag="autocommand-list" replace="autocommand-list">
|
<dl tag="autocommand-list" tag="autocommand-list" replace="autocommand-list">
|
||||||
<dt>BookmarkAdd</dt> <dd>Triggered after a page is bookmarked</dd>
|
<dt>BookmarkAdd</dt> <dd>Triggered after a page is bookmarked</dd>
|
||||||
<dt>BookmarkChange</dt> <dd>Triggered after a page's bookmark is changed</dd>
|
<dt>BookmarkChange</dt> <dd>Triggered after a page's bookmark is changed</dd>
|
||||||
<dt>BookmarkRemove</dt> <dd>Triggered after a page's bookmark is removed</dd>
|
<dt>BookmarkRemove</dt> <dd>Triggered after a page's bookmark is removed</dd>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<dt>Leave</dt> <dd>Triggered before exiting &dactyl.host;</dd>
|
<dt>Leave</dt> <dd>Triggered before exiting &dactyl.host;</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<dl tag="autocommand-args" replace="autocommand-args">
|
<dl tag="autocommand-args" tag="autocommand-args"replace="autocommand-args">
|
||||||
<dt><bookmark></dt> <dd>The JavaScript bookmark object. Only for <em>Bookmark*</em>.</dd>
|
<dt><bookmark></dt> <dd>The JavaScript bookmark object. Only for <em>Bookmark*</em>.</dd>
|
||||||
<dt><changed></dt> <dd>The name of the property that has changed. Only for <em>BookmarkChange</em>.</dd>
|
<dt><changed></dt> <dd>The name of the property that has changed. Only for <em>BookmarkChange</em>.</dd>
|
||||||
<dt><doc></dt> <dd>The document for which the event occurred. Only for <em>DOMLoad</em>, <em>PageLoad</em> and <em>PageLoadPre</em>.</dd>
|
<dt><doc></dt> <dd>The document for which the event occurred. Only for <em>DOMLoad</em>, <em>PageLoad</em> and <em>PageLoadPre</em>.</dd>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
and finger feel should be familiar to Vim users.
|
and finger feel should be familiar to Vim users.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ol replace="topics-list">
|
<ol tag="topics-list" replace="topics-list">
|
||||||
<li>
|
<li>
|
||||||
<link topic="tutorial">Quick-start tutorial</link>:
|
<link topic="tutorial">Quick-start tutorial</link>:
|
||||||
A quick-start tutorial for new users.
|
A quick-start tutorial for new users.
|
||||||
@@ -116,7 +116,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<ul replace="features-list">
|
<ul tag="features-list" replace="features-list">
|
||||||
<li>Vim-like keybindings (<k>h</k>, <k>j</k>, <k>gg</k>, <k>ZZ</k>, <k name="C-f"/>, etc.)</li>
|
<li>Vim-like keybindings (<k>h</k>, <k>j</k>, <k>gg</k>, <k>ZZ</k>, <k name="C-f"/>, etc.)</li>
|
||||||
<li>Ex commands (<ex>:quit</ex>, <ex>:open www.foo.com</ex>, …)</li>
|
<li>Ex commands (<ex>:quit</ex>, <ex>:open www.foo.com</ex>, …)</li>
|
||||||
<li>Tab completion for all commands, highly configurable via <o>wildmode</o>, <o>autocomplete</o>, ...</li>
|
<li>Tab completion for all commands, highly configurable via <o>wildmode</o>, <o>autocomplete</o>, ...</li>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
xmlns="&xmlns.dactyl;"
|
xmlns="&xmlns.dactyl;"
|
||||||
xmlns:html="&xmlns.html;">
|
xmlns:html="&xmlns.html;">
|
||||||
|
|
||||||
<dl replace=":command-complete-arg-list">
|
<dl tag=":command-complete-arg-list" replace=":command-complete-arg-list">
|
||||||
<dt>abbreviation</dt> <dd>abbreviations</dd>
|
<dt>abbreviation</dt> <dd>abbreviations</dd>
|
||||||
<dt>altstyle</dt> <dd>alternate author style sheets</dd>
|
<dt>altstyle</dt> <dd>alternate author style sheets</dd>
|
||||||
<dt>bookmark</dt> <dd>bookmarks</dd>
|
<dt>bookmark</dt> <dd>bookmarks</dd>
|
||||||
|
|||||||
Reference in New Issue
Block a user