diff --git a/common/content/dactyl.js b/common/content/dactyl.js
index dd4f6f8b..b52e5077 100644
--- a/common/content/dactyl.js
+++ b/common/content/dactyl.js
@@ -685,7 +685,7 @@ const Dactyl = Module("dactyl", {
* @param {XMLList} extraHelp Extra help text beyond the description.
* @returns {string}
*/
- generateHelp: function generateHelp(obj, extraHelp, str) {
+ generateHelp: function generateHelp(obj, extraHelp, str, specOnly) {
default xml namespace = "";
let link, tag, spec;
@@ -696,6 +696,7 @@ const Dactyl = Module("dactyl", {
tag = spec = function (cmd) <>:{cmd}>;
link = function (cmd) :{cmd};
args = obj.parseArgs("", CompletionContext(str || ""));
+ spec = function (cmd) cmd + (obj.bang ? ! : <>>);
}
else if (obj instanceof Map && obj.count) {
spec = function (map) <>count{map}>;
@@ -715,10 +716,16 @@ const Dactyl = Module("dactyl", {
>;
let res =
- {link(obj.name)} {obj.description ? obj.description.replace(/\.$/, "") : ""}
+ {link(obj.name)} {obj.description ? obj.description.replace(/\.$/, "") : ""};
+ if (!specOnly) {
+ res.* += <>
-
{template.map(obj.names.slice().reverse(), tag, " ")}
- {spec((obj.specs || obj.names)[0])}{
+ {
+ spec(template.highlightRegexp((obj.specs || obj.names)[0],
+ /\[(.*?)\]/g,
+ function (m, n0) {n0}))
+ }{
!obj.type ? "" : <>
{obj.type}
{obj.stringDefaultValue}>}
@@ -727,32 +734,33 @@ const Dactyl = Module("dactyl", {
extraHelp ? br + extraHelp : "" }{
!(extraHelp || obj.description) ? br +
Sorry, no help available.
: "" }
- ;
+ >;
- function add(ary) {
- res.item.description.* += br +
- let (br = br + <> >)
- <>
{ br + template.map(ary, function ([a, b]) <>- {a}
- {b}
>, br) }
-
- >;
+ function add(ary) {
+ res.item.description.* += br +
+ let (br = br + <> >)
+ <>{ br + template.map(ary, function ([a, b]) <>- {a}
- {b}
>, br) }
+
+ >;
+ }
+
+ if (obj.completer)
+ add(completion._runCompleter(obj.completer, "", null, args).items
+ .map(function (i) [i.text, i.description]));
+
+ if (obj.options && obj.options.some(function (o) o.description))
+ add(obj.options.filter(function (o) o.description)
+ .map(function (o) [
+ o.names[0],
+ <>{o.description}{
+ o.names.length == 1 ? "" :
+ <> (short name: {
+ template.map(o.names.slice(1), function (n) {n}, <>, >)
+ })>
+ }>
+ ]));
}
-
- if (obj.completer)
- add(completion._runCompleter(obj.completer, "", null, args).items
- .map(function (i) [i.text, i.description]));
-
- if (obj.options && obj.options.some(function (o) o.description))
- add(obj.options.filter(function (o) o.description)
- .map(function (o) [
- o.names[0],
- <>{o.description}{
- o.names.length == 1 ? "" :
- <> (short name: {
- template.map(o.names.slice(1), function (n) {n}, <>, >)
- })>
- }>
- ]));
- return res.*.toXMLString().replace(/^ {12}|[ \t]+$/gm, "");
+ return res.*.toXMLString().replace(/^ {12}|[ \t]+$/gm, "").replace(/^.*\n|\n.*$/g, "") + "\n";
},
/**
@@ -1764,9 +1772,9 @@ const Dactyl = Module("dactyl", {
commands.add(["norm[al]"],
"Execute Normal mode commands",
- function (args) { events.feedkeys(args[0] || "", args.bang, false, modes.NORMAL); },
+ function (args) { events.feedkeys(args[0], args.bang, false, modes.NORMAL); },
{
- argCount: "+",
+ argCount: "1",
bang: true,
literal: 0
});
diff --git a/common/content/mappings.js b/common/content/mappings.js
index 816eb214..48627f80 100644
--- a/common/content/mappings.js
+++ b/common/content/mappings.js
@@ -419,15 +419,12 @@ const Mappings = Module("mappings", {
names: ["-javascript", "-js", "-j"],
description: "Execute this mapping as JavaScript rather than keys"
},
- {
+ update({}, modeFlag, {
names: ["-modes", "-mode", "-m"],
type: CommandOption.LIST,
description: "Create this mapping in the given modes",
default: mapmodes || ["n", "v"],
- validator: function (list) !list || list.every(findMode),
- completer: function () [[array.compact([mode.name.toLowerCase().replace(/_/g, "-"), mode.char]), mode.disp]
- for (mode in values(modes.all))],
- },
+ }),
{
names: ["-nopersist", "-n"],
description: "Do not save this mapping to an auto-generated RC file"
@@ -501,10 +498,20 @@ const Mappings = Module("mappings", {
});
}
+ let modeFlag = {
+ names: ["-mode", "-m"],
+ type: CommandOption.STRING,
+ validator: function (value) Array.concat(value).every(findMode),
+ completer: function () [[array.compact([mode.name.toLowerCase().replace(/_/g, "-"), mode.char]), mode.disp]
+ for (mode in values(modes.all))],
+ };
+
function findMode(name) {
- for (let mode in values(modes.all))
- if (name == mode || name == mode.char || String.toLowerCase(name).replace(/-/g, "_") == mode.name.toLowerCase())
- return mode.mask;
+ if (name)
+ for (let mode in values(modes.all))
+ if (name == mode || name == mode.char
+ || String.toLowerCase(name).replace(/-/g, "_") == mode.name.toLowerCase())
+ return mode.mask;
return null;
}
function uniqueModes(modes) {
@@ -514,6 +521,20 @@ const Mappings = Module("mappings", {
return array.uniq(modes.filter(function (m) chars.indexOf(m.char) < 0).concat(chars));
}
+ commands.add(["feedkeys", "fk"],
+ "Fake key events",
+ function (args) { events.feedkeys(args[0] || "", args.bang, false, findMode(args["-mode"])); },
+ {
+ argCount: "1",
+ bang: true,
+ literal: 0,
+ options: [
+ update({}, modeFlag, {
+ description: "The in which to feed the keys"
+ })
+ ]
+ });
+
addMapCommands("", [modes.NORMAL, modes.VISUAL], "");
let args = {
@@ -540,15 +561,10 @@ const Mappings = Module("mappings", {
name: ["listk[eys]", "lk"],
description: "List all mappings along with their short descriptions",
options: [
- {
- names: ["-mode", "-m"],
- type: CommandOption.STRING,
- description: "The mode for which to list mappings",
+ update({}, modeFlag, {
default: "n",
- completer: function () [[array.compact([mode.name.toLowerCase().replace(/_/g, "-"), mode.char]), mode.disp]
- for (mode in values(modes.all))],
- validator: function (m) findMode(m)
- }
+ description: "The mode for which to list mappings"
+ })
]
});
diff --git a/common/locale/en-US/index.xml b/common/locale/en-US/index.xml
index 343638a8..26a616e7 100644
--- a/common/locale/en-US/index.xml
+++ b/common/locale/en-US/index.xml
@@ -255,6 +255,7 @@ This file contains a list of all available commands, mappings and options.
:extensions List all installed extensions
:extoptions Open an extension's preference dialog
:extupdate Update an extension
+ :feedkeys Fake key events
:finish Stop sourcing a script file
:forward Go forward in the browser history
:frameonly Show only the current frame's page
diff --git a/common/locale/en-US/various.xml b/common/locale/en-US/various.xml
index 2ee221e2..327a7897 100644
--- a/common/locale/en-US/various.xml
+++ b/common/locale/en-US/various.xml
@@ -23,14 +23,26 @@
arguments. These context names may be used to tune the function of
the completion system via options like autocomplete and
wildcase. Note that completion must be triggered in order
- for this command to be effective, so if autocompletion is not
+ for this command to be effective, so if auto-completion is not
active, you'll need to press the key at
least once. You should also be aware that this command is only
- useful from the commandline.
+ useful from the command line.
+-
+ :fk :feedkeys
+ feedkeys!
+
+
Fake key events.
+
+
+ - -mode
- The in which to feed the keys (short name: -m)
+
+
+
+
-
:norm :normal
:normal! keys
diff --git a/common/modules/template.jsm b/common/modules/template.jsm
index 6b27b5eb..b8bab403 100644
--- a/common/modules/template.jsm
+++ b/common/modules/template.jsm
@@ -153,7 +153,7 @@ const Template = Module("Template", {
return this.highlightSubstrings(str, (function () {
let res;
while ((res = re.exec(str)) && res[0].length)
- yield [res.index, res[0].length];
+ yield [res.index, res[0].length, res];
})(), highlight || template.filter);
},
@@ -168,12 +168,12 @@ const Template = Module("Template", {
let s = <>>;
let start = 0;
let n = 0;
- for (let [i, length] in iter) {
+ for (let [i, length, args] in iter) {
if (n++ > 50) // Prevent infinite loops.
break;
XML.ignoreWhitespace = false;
s += <>{str.substring(start, i)}>;
- s += highlight(str.substr(i, length));
+ s += highlight.apply(this, Array.slice(args || str.substr(i, length)));
start = i + length;
}
return s + <>{str.substr(start)}>;
diff --git a/pentadactyl/NEWS b/pentadactyl/NEWS
index 21783ec9..8bb7a308 100644
--- a/pentadactyl/NEWS
+++ b/pentadactyl/NEWS
@@ -49,12 +49,31 @@
* The concept of completion contexts is now exposed to the user
(see :h :contexts), allowing for powerful and fine-grained
completion system customization.
- * :viusage, :optionusage and :exusage were replaced with :listkeys,
- :listoptions and :listcommands, providing more powerful and
- consistent interactive help facility (improvements include
- listing keys for modes other than Normal, filtering the output
- and linking to source locations).
- * Added :mksyntax command.
+ * Command changes:
+ - :viusage, :optionusage and :exusage were replaced with :listkeys,
+ :listoptions and :listcommands, providing more powerful and
+ consistent interactive help facility (improvements include
+ listing keys for modes other than Normal, filtering the output
+ and linking to source locations).
+ - Added :cookies command.
+ * :extadd now supports remote URLs as well as local files on Firefox 4.
+ * Added :if/:elseif/:else/:endif conditionals.
+ - Added -keyword, -tags, -title to :delbmarks.
+ - Added :extupdate command.
+ - Added :feedkeys command.
+ - Added several new options, including -javascript, to :abbrev and :map.
+ - Added :mksyntax command.
+ - :open now only opens files beginning with /, ./, ../, or ~/
+ - Added :write !cmd and :write >>file.
+ - Added :yank command.
+ * Improvements to :style and :highlight:
+ - Added -agent flag to :style.
+ - The -append flag now updates existing properties rather than
+ simply appending its arguments to the previous value.
+ - Active filters are not highlighted in :style listings
+ - :style-related commands now divide their completions between
+ those active and inactive for the current site.
+ - CSS property name completion is not available
* IMPORTANT option changes:
- 'cdpath' and 'runtimepath' no longer treat ",,"
specially. Use "." instead.
@@ -80,36 +99,26 @@
operators, and = sign may no longer be quoted. This will break
certain automatically-generated configuration files.
See :help stringlist
- * Added "bookmarks", "diverted", and "links" to 'activate'
- option.
- * Added 'altwildmode' and command-line key binding.
- * Added 'autocomplete' option for specifying which completion
- groups should be auto-completed.
- * Added 'banghist' option.
+ * Option changes:
+ - Added "bookmarks", "diverted", and "links" to 'activate'
+ option.
+ - Added 'altwildmode' and command-line key binding.
+ - Added 'autocomplete' option for specifying which completion
+ groups should be auto-completed.
+ - Added 'banghist' option.
+ - Replaced 'focuscontent' with 'strictfocus'.
+ - 'complete' now defaults to "slf" but file completion only
+ triggers when the URL begins as above.
+ - Added 'passkeys' option.
+ - Changed 'urlseparator' default value to '|'.
+ - Added "passwords" and "venkman" dialogs to :dialog.
+ - Added 'wildanchor' option.
+ - Added 'cookies', 'cookieaccept', and 'cookielifetime' options.
* Added BookmarkChange, BookmarkRemove autocommands.
- * Added :cookies, 'cookies', 'cookieaccept', and 'cookielifetime'.
- * Added -keyword, -tags, -title to :delbmarks.
- * Added "passwords" and "venkman" dialogs to :dialog.
- * Added :extupdate command.
- * Replaced 'focuscontent' with 'strictfocus'.
- * Added :if/:elseif/:else/:endif conditionals.
- * Added 'passkeys' option.
- * Changed 'urlseparator' default value to '|'.
- * Added 'wildanchor' option.
- * Added -javascript option to :abbrev and :map.
- * Added several new options to :map.
- * Added -agent flag to :style.
- * Added :write !cmd and :write >>file.
- * Added :yank command.
* Removed the :source line at the end of files generated by
:mkpentadactylrc.
* gf now toggles between source and content view.
The | key binding has been removed.
- * :extadd now supports remote URLs as well as local files on
- Firefox 4.
- * :open now only opens files beginning with /, ./, ../, or ~/
- * 'complete' now defaults to "slf" but file completion only
- triggers when the URL begins as above.
* Page zoom information is now shown in the status bar, and
change in zoom status no longer appears in :messages.
* Added ZO, ZI, ZM, and ZR as aliases for zO, zI, zM, and zR.