mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-18 21:30:18 +01:00
Replace expression closures (command/option/mapping definitions).
Expression closures are to be axed. See https://bugzil.la/1083458.
This commit is contained in:
@@ -341,9 +341,9 @@ var Abbreviations = Module("abbreviations", {
|
||||
identifier: "abbreviate",
|
||||
completer: function (context, args) {
|
||||
if (args.length == 1)
|
||||
return completion.abbreviation(context, modes, args["-group"]);
|
||||
completion.abbreviation(context, modes, args["-group"]);
|
||||
else if (args["-javascript"])
|
||||
return completion.javascript(context);
|
||||
completion.javascript(context);
|
||||
},
|
||||
hereDoc: true,
|
||||
literal: 1,
|
||||
@@ -354,22 +354,24 @@ var Abbreviations = Module("abbreviations", {
|
||||
description: "Expand this abbreviation by evaluating its right-hand-side as JavaScript"
|
||||
}
|
||||
],
|
||||
serialize: function () Ary(abbreviations.userHives)
|
||||
.filter(h => h.persist)
|
||||
.map(hive => [
|
||||
{
|
||||
command: this.name,
|
||||
arguments: [abbr.lhs],
|
||||
literalArg: abbr.rhs,
|
||||
options: {
|
||||
"-group": hive.name == "user" ? undefined : hive.name,
|
||||
"-javascript": callable(abbr.rhs) ? null : undefined
|
||||
serialize: function () {
|
||||
return Ary(abbreviations.userHives)
|
||||
.filter(h => h.persist)
|
||||
.map(hive => [
|
||||
{
|
||||
command: this.name,
|
||||
arguments: [abbr.lhs],
|
||||
literalArg: abbr.rhs,
|
||||
options: {
|
||||
"-group": hive.name == "user" ? undefined : hive.name,
|
||||
"-javascript": callable(abbr.rhs) ? null : undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
for (abbr of hive.merged)
|
||||
if (abbr.modesEqual(modes))
|
||||
]).
|
||||
flatten().array
|
||||
for (abbr of hive.merged)
|
||||
if (abbr.modesEqual(modes))
|
||||
]).
|
||||
flatten().array;
|
||||
}
|
||||
});
|
||||
|
||||
commands.add([ch + "una[bbreviate]"],
|
||||
@@ -384,7 +386,9 @@ var Abbreviations = Module("abbreviations", {
|
||||
}, {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
completer: function (context, args) completion.abbreviation(context, modes, args["-group"]),
|
||||
completer: function (context, args) {
|
||||
completion.abbreviation(context, modes, args["-group"]);
|
||||
},
|
||||
literal: 0,
|
||||
options: [contexts.GroupFlag("abbrevs")]
|
||||
});
|
||||
|
||||
@@ -213,9 +213,9 @@ var AutoCommands = Module("autocommands", {
|
||||
bang: true,
|
||||
completer: function (context, args) {
|
||||
if (args.length == 1)
|
||||
return completion.autocmdEvent(context);
|
||||
if (args.length == 3)
|
||||
return args["-javascript"] ? completion.javascript(context) : completion.ex(context);
|
||||
completion.autocmdEvent(context);
|
||||
else if (args.length == 3)
|
||||
args["-javascript"] ? completion.javascript(context) : completion.ex(context);
|
||||
},
|
||||
hereDoc: true,
|
||||
keepQuotes: true,
|
||||
@@ -273,7 +273,9 @@ var AutoCommands = Module("autocommands", {
|
||||
autocommands.trigger(event, { url: uri.spec });
|
||||
}, {
|
||||
argCount: "*", // FIXME: kludged for proper error message should be "1".
|
||||
completer: function (context) completion.autocmdEvent(context),
|
||||
completer: function (context) {
|
||||
completion.autocmdEvent(context);
|
||||
},
|
||||
keepQuotes: true
|
||||
});
|
||||
});
|
||||
|
||||
@@ -516,16 +516,18 @@ var Bookmarks = Module("bookmarks", {
|
||||
context.completions = [
|
||||
[win.document.documentURI, frames.length == 1 ? /*L*/"Current Location" : /*L*/"Frame: " + win.document.title]
|
||||
for (win of frames)];
|
||||
return;
|
||||
}
|
||||
completion.bookmark(context, args["-tags"], { keyword: args["-keyword"], title: args["-title"] });
|
||||
else
|
||||
completion.bookmark(context, args["-tags"], { keyword: args["-keyword"], title: args["-title"] });
|
||||
},
|
||||
options: [keyword, title, tags, post,
|
||||
{
|
||||
names: ["-charset", "-c"],
|
||||
description: "The character encoding of the bookmark",
|
||||
type: CommandOption.STRING,
|
||||
completer: function (context) completion.charset(context),
|
||||
completer: function (context) {
|
||||
completion.charset(context);
|
||||
},
|
||||
validator: io.bound.validateCharset
|
||||
},
|
||||
{
|
||||
@@ -541,8 +543,7 @@ var Bookmarks = Module("bookmarks", {
|
||||
function (args) {
|
||||
bookmarks.list(args.join(" "), args["-tags"] || [], args.bang, args["-max"],
|
||||
{ keyword: args["-keyword"], title: args["-title"] });
|
||||
},
|
||||
{
|
||||
}, {
|
||||
bang: true,
|
||||
completer: function completer(context, args) {
|
||||
context.filter = args.join(" ");
|
||||
@@ -584,13 +585,15 @@ var Bookmarks = Module("bookmarks", {
|
||||
dactyl.echomsg({ message: _("bookmark.deleted", deletedCount) });
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
completer: function completer(context, args)
|
||||
completion.bookmark(context, args["-tags"], { keyword: args["-keyword"], title: args["-title"] }),
|
||||
domains: function (args) Ary.compact(args.map(util.getHost)),
|
||||
completer: function completer(context, args) {
|
||||
completion.bookmark(context, args["-tags"], { keyword: args["-keyword"], title: args["-title"] });
|
||||
},
|
||||
domains: function (args) {
|
||||
return Ary.compact(args.map(util.getHost));
|
||||
},
|
||||
literal: 0,
|
||||
options: [tags, title, keyword],
|
||||
privateData: true
|
||||
@@ -643,14 +646,21 @@ var Bookmarks = Module("bookmarks", {
|
||||
{
|
||||
completer: function completer(context) {
|
||||
completion.search(context, true);
|
||||
context.completions = [{ keyword: "", title: "Don't perform searches by default" }].concat(context.completions);
|
||||
context.completions = [{
|
||||
keyword: "",
|
||||
title: "Don't perform searches by default"
|
||||
}].concat(context.completions);
|
||||
}
|
||||
});
|
||||
|
||||
options.add(["suggestengines"],
|
||||
"Search engines used for search suggestions",
|
||||
"stringlist", "google",
|
||||
{ completer: function completer(context) completion.searchEngine(context, true) });
|
||||
{
|
||||
completer: function completer(context) {
|
||||
completion.searchEngine(context, true);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
completion: function initCompletion() {
|
||||
|
||||
@@ -208,11 +208,14 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
||||
commands: function initCommands(dactyl, modules, window) {
|
||||
commands.add(["o[pen]"],
|
||||
"Open one or more URLs in the current tab",
|
||||
function (args) { dactyl.open(args[0] || "about:blank"); },
|
||||
{
|
||||
completer: function (context) completion.url(context),
|
||||
domains: function (args) Ary.compact(dactyl.parseURLs(args[0] || "")
|
||||
.map(url => util.getHost(url))),
|
||||
function (args) {
|
||||
dactyl.open(args[0] || "about:blank");
|
||||
}, {
|
||||
completer: function (context) { completion.url(context); },
|
||||
domains: function (args) {
|
||||
return Ary.compact(dactyl.parseURLs(args[0] || "")
|
||||
.map(url => util.getHost(url)));
|
||||
},
|
||||
literal: 0,
|
||||
privateData: true
|
||||
});
|
||||
|
||||
@@ -1690,7 +1690,9 @@ var CommandLine = Module("commandline", {
|
||||
function (args) {
|
||||
command.action(CommandLine.echoArgumentToString(args[0] || "", true));
|
||||
}, {
|
||||
completer: function (context) completion.javascript(context),
|
||||
completer: function (context) {
|
||||
completion.javascript(context);
|
||||
},
|
||||
literal: 0
|
||||
});
|
||||
});
|
||||
@@ -1723,7 +1725,7 @@ var CommandLine = Module("commandline", {
|
||||
function (args) {
|
||||
commandline.runSilently(() => { commands.execute(args[0] || "", null, true); });
|
||||
}, {
|
||||
completer: function (context) completion.ex(context),
|
||||
completer: function (context) { completion.ex(context); },
|
||||
literal: 0,
|
||||
subCommand: 0
|
||||
});
|
||||
@@ -1884,17 +1886,17 @@ var CommandLine = Module("commandline", {
|
||||
options.add(["history", "hi"],
|
||||
"Number of Ex commands and search patterns to store in the command-line history",
|
||||
"number", 500,
|
||||
{ validator: function (value) value >= 0 });
|
||||
{ validator: function (value) { return value >= 0; } });
|
||||
|
||||
options.add(["maxitems"],
|
||||
"Maximum number of completion items to display at once",
|
||||
"number", 20,
|
||||
{ validator: function (value) value >= 1 });
|
||||
{ validator: function (value) { return value >= 1; } });
|
||||
|
||||
options.add(["messages", "msgs"],
|
||||
"Number of messages to store in the :messages history",
|
||||
"number", 100,
|
||||
{ validator: function (value) value >= 0 });
|
||||
{ validator: function (value) { return value >= 0; } });
|
||||
},
|
||||
sanitizer: function initSanitizer() {
|
||||
sanitizer.addItem("commandline", {
|
||||
|
||||
@@ -252,8 +252,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
|
||||
commandline.commandOutput(
|
||||
template.usage(results, params.format));
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "*",
|
||||
completer: function (context, args) {
|
||||
context.keys.text = identity;
|
||||
@@ -1332,8 +1331,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
options.add(["fullscreen", "fs"],
|
||||
"Show the current window fullscreen",
|
||||
"boolean", false, {
|
||||
setter: function (value) window.fullScreen = value,
|
||||
getter: function () window.fullScreen
|
||||
setter: function (value) { return window.fullScreen = value; },
|
||||
getter: function () { return window.fullScreen; }
|
||||
});
|
||||
|
||||
const groups = [
|
||||
@@ -1382,8 +1381,10 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
prefs.safeSet("layout.scrollbar.side", opts.indexOf("l") >= 0 ? 3 : 2,
|
||||
_("option.guioptions.safeSet"));
|
||||
},
|
||||
validator: function (opts) Option.validIf(!(opts.indexOf("l") >= 0 && opts.indexOf("r") >= 0),
|
||||
UTF8("Only one of ‘l’ or ‘r’ allowed"))
|
||||
validator: function (opts) {
|
||||
return Option.validIf(!(opts.indexOf("l") >= 0 && opts.indexOf("r") >= 0),
|
||||
UTF8("Only one of ‘l’ or ‘r’ allowed"));
|
||||
}
|
||||
},
|
||||
{
|
||||
feature: "tabs",
|
||||
@@ -1421,8 +1422,10 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
events.checkFocus();
|
||||
return value;
|
||||
},
|
||||
validator: function (val) Option.validateCompleter.call(this, val)
|
||||
&& groups.every(g => !g.validator || g.validator(val))
|
||||
validator: function (val) {
|
||||
return Option.validateCompleter.call(this, val) &&
|
||||
groups.every(g => !g.validator || g.validator(val));
|
||||
}
|
||||
});
|
||||
|
||||
options.add(["loadplugins", "lpl"],
|
||||
@@ -1466,13 +1469,17 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
options.add(["urlseparator", "urlsep", "us"],
|
||||
"The regular expression used to separate multiple URLs in :open and friends",
|
||||
"string", " \\| ",
|
||||
{ validator: function (value) RegExp(value) });
|
||||
{ validator: function (value) { return RegExp(value); } });
|
||||
|
||||
options.add(["verbose", "vbs"],
|
||||
"Define which info messages are displayed",
|
||||
"number", 1,
|
||||
{ validator: function (value) Option.validIf(value >= 0 && value <= 15,
|
||||
"Value must be between 0 and 15") });
|
||||
{
|
||||
validator: function (value) {
|
||||
return Option.validIf(value >= 0 && value <= 15,
|
||||
"Value must be between 0 and 15");
|
||||
}
|
||||
});
|
||||
|
||||
options.add(["visualbell", "vb"],
|
||||
"Use visual bell instead of beeping on errors",
|
||||
@@ -1538,7 +1545,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
}
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) completion.menuItem(context),
|
||||
completer: function (context) {
|
||||
completion.menuItem(context);
|
||||
},
|
||||
literal: 0
|
||||
});
|
||||
|
||||
@@ -1553,7 +1562,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
dactyl.echoerr(e);
|
||||
}
|
||||
}, {
|
||||
completer: function (context) completion.javascript(context),
|
||||
completer: function (context) {
|
||||
completion.javascript(context);
|
||||
},
|
||||
literal: 0
|
||||
});
|
||||
|
||||
@@ -1561,18 +1572,17 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
"Load all or matching plugins",
|
||||
function (args) {
|
||||
dactyl.loadPlugins(args.length ? args : null, args.bang);
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "*",
|
||||
bang: true,
|
||||
keepQuotes: true,
|
||||
serialGroup: 10,
|
||||
serialize: function () [
|
||||
{
|
||||
serialize: function () {
|
||||
return [{
|
||||
command: this.name,
|
||||
literalArg: options["loadplugins"].join(" ")
|
||||
}
|
||||
]
|
||||
}];
|
||||
}
|
||||
});
|
||||
|
||||
commands.add(["norm[al]"],
|
||||
@@ -1593,7 +1603,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
});
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) completion.ex(context),
|
||||
completer: function (context) { completion.ex(context); },
|
||||
literal: 0,
|
||||
privateData: "never-save",
|
||||
subCommand: 0
|
||||
@@ -1799,9 +1809,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
bang: true,
|
||||
completer: function (context) {
|
||||
if (/^:/.test(context.filter))
|
||||
return completion.ex(context);
|
||||
completion.ex(context);
|
||||
else
|
||||
return completion.javascript(context);
|
||||
completion.javascript(context);
|
||||
},
|
||||
count: true,
|
||||
hereDoc: true,
|
||||
@@ -1827,7 +1837,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
}
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) completion.ex(context),
|
||||
completer: function (context) { completion.ex(context); },
|
||||
count: true,
|
||||
literal: 0,
|
||||
subCommand: 0
|
||||
|
||||
@@ -1382,7 +1382,9 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
||||
args.push(obj["file"]);
|
||||
return args;
|
||||
},
|
||||
has: function (key) util.compileMacro(this.value).seen.has(key),
|
||||
has: function (key) {
|
||||
return util.compileMacro(this.value).seen.has(key);
|
||||
},
|
||||
validator: function (value) {
|
||||
this.format({}, value);
|
||||
let allowed = new RealSet(["column", "file", "line"]);
|
||||
|
||||
@@ -1033,15 +1033,17 @@ var Events = Module("events", {
|
||||
}, {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
completer: function (context) completion.macro(context),
|
||||
completer: function (context) { completion.macro(context); },
|
||||
literal: 0
|
||||
});
|
||||
|
||||
commands.add(["mac[ros]"],
|
||||
"List all macros",
|
||||
function (args) { completion.listCompleter("macro", args[0]); }, {
|
||||
function (args) {
|
||||
completion.listCompleter("macro", args[0]);
|
||||
}, {
|
||||
argCount: "?",
|
||||
completer: function (context) completion.macro(context)
|
||||
completer: function (context) { completion.macro(context); }
|
||||
});
|
||||
},
|
||||
completion: function initCompletion() {
|
||||
@@ -1168,7 +1170,10 @@ var Events = Module("events", {
|
||||
});
|
||||
},
|
||||
|
||||
has: function (key) this.pass.has(key) || hasOwnProperty(this.commandHive.stack.mappings, key),
|
||||
has: function (key) {
|
||||
return this.pass.has(key) ||
|
||||
hasOwnProperty(this.commandHive.stack.mappings, key);
|
||||
},
|
||||
|
||||
get pass() { this.flush(); return this.pass; },
|
||||
|
||||
|
||||
@@ -1381,7 +1381,7 @@ var Hints = Module("hints", {
|
||||
options.add(["hinttimeout", "hto"],
|
||||
"Timeout before automatically following a non-unique numerical hint",
|
||||
"number", 0,
|
||||
{ validator: function (value) value >= 0 });
|
||||
{ validator: function (value) { return value >= 0; } });
|
||||
|
||||
options.add(["followhints", "fh"],
|
||||
"Define the conditions under which selected hints are followed",
|
||||
@@ -1404,15 +1404,17 @@ var Hints = Module("hints", {
|
||||
"wordstartswith": "The typed characters are split on whitespace. The resulting groups must all match the beginnings of words, in order.",
|
||||
"transliterated": UTF8("When true, special latin characters are translated to their ASCII equivalents (e.g., é ⇒ e)")
|
||||
},
|
||||
validator: function (values) Option.validateCompleter.call(this, values) &&
|
||||
1 === values.reduce((acc, v) => acc + (["contains", "custom", "firstletters", "wordstartswith"].indexOf(v) >= 0),
|
||||
0)
|
||||
validator: function (values) {
|
||||
return Option.validateCompleter.call(this, values) &&
|
||||
1 === values.reduce((acc, v) => acc + (["contains", "custom", "firstletters", "wordstartswith"].indexOf(v) >= 0),
|
||||
0);
|
||||
}
|
||||
});
|
||||
|
||||
options.add(["wordseparators", "wsp"],
|
||||
"Regular expression defining which characters separate words when matching hints",
|
||||
"string", '[.,!?:;/"^$%&?()[\\]{}<>#*+|=~ _-]',
|
||||
{ validator: function (value) RegExp(value) });
|
||||
{ validator: function (value) { return RegExp(value); } });
|
||||
|
||||
options.add(["hintinputs", "hin"],
|
||||
"Which text is used to filter hints for input elements",
|
||||
|
||||
@@ -200,8 +200,7 @@ var History = Module("history", {
|
||||
history.stepTo(-Math.max(args.count, 1));
|
||||
}
|
||||
return null;
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
completer: function completer(context) {
|
||||
@@ -211,9 +210,13 @@ var History = Module("history", {
|
||||
context.compare = CompletionContext.Sort.unsorted;
|
||||
context.filters = [CompletionContext.Filter.textDescription];
|
||||
context.completions = sh.slice(0, sh.index).reverse();
|
||||
context.keys = { text: function (item) (sh.index - item.index) + ": " + item.URI.spec,
|
||||
description: "title",
|
||||
icon: "icon" };
|
||||
context.keys = {
|
||||
text: function (item) {
|
||||
return (sh.index - item.index) + ": " + item.URI.spec;
|
||||
},
|
||||
description: "title",
|
||||
icon: "icon"
|
||||
};
|
||||
},
|
||||
count: true,
|
||||
literal: 0,
|
||||
@@ -242,8 +245,7 @@ var History = Module("history", {
|
||||
history.stepTo(Math.max(args.count, 1));
|
||||
}
|
||||
return null;
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
completer: function completer(context) {
|
||||
@@ -253,9 +255,13 @@ var History = Module("history", {
|
||||
context.compare = CompletionContext.Sort.unsorted;
|
||||
context.filters = [CompletionContext.Filter.textDescription];
|
||||
context.completions = sh.slice(sh.index + 1);
|
||||
context.keys = { text: function (item) (item.index - sh.index) + ": " + item.URI.spec,
|
||||
description: "title",
|
||||
icon: "icon" };
|
||||
context.keys = {
|
||||
text: function (item) {
|
||||
return (item.index - sh.index) + ": " + item.URI.spec;
|
||||
},
|
||||
description: "title",
|
||||
icon: "icon"
|
||||
};
|
||||
},
|
||||
count: true,
|
||||
literal: 0,
|
||||
@@ -264,9 +270,13 @@ var History = Module("history", {
|
||||
|
||||
commands.add(["hist[ory]", "hs"],
|
||||
"Show recently visited URLs",
|
||||
function (args) { history.list(args.join(" "), args.bang, args["-max"], args["-sort"]); }, {
|
||||
function (args) {
|
||||
history.list(args.join(" "), args.bang, args["-max"], args["-sort"]);
|
||||
}, {
|
||||
bang: true,
|
||||
completer: function (context, args) completion.history(context, args["-max"], args["-sort"]),
|
||||
completer: function (context, args) {
|
||||
completion.history(context, args["-max"], args["-sort"]);
|
||||
},
|
||||
options: [
|
||||
{
|
||||
names: ["-max", "-m"],
|
||||
|
||||
@@ -575,12 +575,12 @@ var Mappings = Module("mappings", {
|
||||
completer: function (context, args) {
|
||||
let mapmodes = Ary.uniq(args["-modes"].map(findMode));
|
||||
if (args.length == 1)
|
||||
return completion.userMapping(context, mapmodes, args["-group"]);
|
||||
if (args.length == 2) {
|
||||
completion.userMapping(context, mapmodes, args["-group"]);
|
||||
else if (args.length == 2) {
|
||||
if (args["-javascript"])
|
||||
return completion.javascript(context);
|
||||
if (args["-ex"])
|
||||
return completion.ex(context);
|
||||
completion.javascript(context);
|
||||
else if (args["-ex"])
|
||||
completion.ex(context);
|
||||
}
|
||||
},
|
||||
hereDoc: true,
|
||||
@@ -629,8 +629,10 @@ var Mappings = Module("mappings", {
|
||||
}
|
||||
],
|
||||
serialize: function () {
|
||||
return this.name != "map" ? [] :
|
||||
Ary(mappings.userHives)
|
||||
if (this.name != "map")
|
||||
return [];
|
||||
else
|
||||
return Ary(mappings.userHives)
|
||||
.filter(h => h.persist)
|
||||
.map(hive => [
|
||||
{
|
||||
@@ -691,8 +693,7 @@ var Mappings = Module("mappings", {
|
||||
|
||||
if (!found && !args.bang)
|
||||
dactyl.echoerr(_("map.noSuch", args[0]));
|
||||
},
|
||||
{
|
||||
}, {
|
||||
identifier: "unmap",
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
@@ -712,10 +713,14 @@ var Mappings = Module("mappings", {
|
||||
let modeFlag = {
|
||||
names: ["-mode", "-m"],
|
||||
type: CommandOption.STRING,
|
||||
validator: function (value) Array.concat(value).every(findMode),
|
||||
completer: function () [[Ary.compact([mode.name.toLowerCase().replace(/_/g, "-"), mode.char]), mode.description]
|
||||
for (mode of modes.all)
|
||||
if (!mode.hidden)]
|
||||
validator: function (value) {
|
||||
return Array.concat(value).every(findMode);
|
||||
},
|
||||
completer: function () {
|
||||
return [[Ary.compact([mode.name.toLowerCase().replace(/_/g, "-"), mode.char]), mode.description]
|
||||
for (mode of modes.all)
|
||||
if (!mode.hidden)];
|
||||
}
|
||||
};
|
||||
|
||||
function findMode(name) {
|
||||
|
||||
@@ -349,10 +349,9 @@ var Marks = Module("marks", {
|
||||
dactyl.assert(!special || !arg, _("error.invalidArgument"));
|
||||
|
||||
marks.remove(arg, special);
|
||||
},
|
||||
{
|
||||
}, {
|
||||
bang: true,
|
||||
completer: function (context) completion.mark(context),
|
||||
completer: function (context) { completion.mark(context); },
|
||||
literal: 0
|
||||
});
|
||||
|
||||
@@ -372,7 +371,7 @@ var Marks = Module("marks", {
|
||||
function (args) {
|
||||
marks.list(args[0] || "");
|
||||
}, {
|
||||
completer: function (context) completion.mark(context),
|
||||
completer: function (context) { completion.mark(context); },
|
||||
literal: 0
|
||||
});
|
||||
},
|
||||
|
||||
@@ -659,8 +659,10 @@ var Modes = Module("modes", {
|
||||
return vals;
|
||||
},
|
||||
|
||||
validator: function validator(vals) vals.map(v => v.replace(/^!/, ""))
|
||||
.every(k => hasOwnProperty(this.values, k)),
|
||||
validator: function validator(vals) {
|
||||
return vals.map(v => v.replace(/^!/, ""))
|
||||
.every(k => hasOwnProperty(this.values, k));
|
||||
},
|
||||
|
||||
get values() {
|
||||
return Ary.toObject([[m.name.toLowerCase(), m.description]
|
||||
|
||||
@@ -131,11 +131,12 @@ var QuickMarks = Module("quickmarks", {
|
||||
quickmarks.removeAll();
|
||||
else
|
||||
quickmarks.remove(args[0]);
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
completer: function (context) completion.quickmark(context)
|
||||
completer: function (context) {
|
||||
completion.quickmark(context);
|
||||
}
|
||||
});
|
||||
|
||||
commands.add(["qma[rk]"],
|
||||
@@ -147,13 +148,12 @@ var QuickMarks = Module("quickmarks", {
|
||||
quickmarks.add(args[0], buffer.uri.spec);
|
||||
else
|
||||
quickmarks.add(args[0], args[1]);
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "+",
|
||||
completer: function (context, args) {
|
||||
if (args.length == 1)
|
||||
return completion.quickmark(context);
|
||||
if (args.length == 2) {
|
||||
completion.quickmark(context);
|
||||
else if (args.length == 2) {
|
||||
context.fork("current", 0, this, context => {
|
||||
context.title = ["Extra Completions"];
|
||||
context.completions = [
|
||||
@@ -172,7 +172,9 @@ var QuickMarks = Module("quickmarks", {
|
||||
quickmarks.list(args[0] || "");
|
||||
}, {
|
||||
argCount: "?",
|
||||
completer: function (context) completion.quickmark(context)
|
||||
completer: function (context) {
|
||||
completion.quickmark(context);
|
||||
}
|
||||
});
|
||||
},
|
||||
completion: function initCompletion() {
|
||||
|
||||
@@ -650,7 +650,9 @@ var Tabs = Module("tabs", {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
count: true,
|
||||
completer: function (context) completion.buffer(context),
|
||||
completer: function (context) {
|
||||
completion.buffer(context);
|
||||
},
|
||||
literal: 0,
|
||||
privateData: true
|
||||
});
|
||||
@@ -661,8 +663,7 @@ var Tabs = Module("tabs", {
|
||||
function (args) {
|
||||
for (let tab of tabs.match(args[0], args.count))
|
||||
config.browser[!args.bang || !tab.pinned ? "pinTab" : "unpinTab"](tab);
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
count: true,
|
||||
@@ -678,8 +679,7 @@ var Tabs = Module("tabs", {
|
||||
function (args) {
|
||||
for (let tab of tabs.match(args[0], args.count))
|
||||
config.browser.unpinTab(tab);
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "?",
|
||||
count: true,
|
||||
completer: function (context) {
|
||||
@@ -699,7 +699,7 @@ var Tabs = Module("tabs", {
|
||||
}
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) completion.ex(context),
|
||||
completer: function (context) { completion.ex(context); },
|
||||
literal: 0,
|
||||
subCommand: 0
|
||||
});
|
||||
@@ -713,7 +713,7 @@ var Tabs = Module("tabs", {
|
||||
});
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) completion.ex(context),
|
||||
completer: function (context) { completion.ex(context); },
|
||||
literal: 0,
|
||||
subCommand: 0
|
||||
});
|
||||
@@ -727,7 +727,7 @@ var Tabs = Module("tabs", {
|
||||
});
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) completion.ex(context),
|
||||
completer: function (context) { completion.ex(context); },
|
||||
literal: 0,
|
||||
subCommand: 0
|
||||
});
|
||||
@@ -741,7 +741,7 @@ var Tabs = Module("tabs", {
|
||||
}
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) completion.ex(context),
|
||||
completer: function (context) { completion.ex(context); },
|
||||
literal: 0,
|
||||
subCommand: 0
|
||||
});
|
||||
@@ -821,7 +821,9 @@ var Tabs = Module("tabs", {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
count: true,
|
||||
completer: function (context) completion.buffer(context),
|
||||
completer: function (context) {
|
||||
completion.buffer(context);
|
||||
},
|
||||
literal: 0,
|
||||
privateData: true
|
||||
});
|
||||
@@ -866,7 +868,9 @@ var Tabs = Module("tabs", {
|
||||
}, {
|
||||
argCount: "1",
|
||||
bang: true,
|
||||
completer: function (context) completion.buffer(context, true),
|
||||
completer: function (context) {
|
||||
completion.buffer(context, true);
|
||||
},
|
||||
literal: 0
|
||||
});
|
||||
|
||||
@@ -882,8 +886,12 @@ var Tabs = Module("tabs", {
|
||||
{ from: "tabopen", where: dactyl.NEW_TAB, background: args.bang });
|
||||
}, {
|
||||
bang: true,
|
||||
completer: function (context) completion.url(context),
|
||||
domains: function (args) commands.get("open").domains(args),
|
||||
completer: function (context) {
|
||||
completion.url(context);
|
||||
},
|
||||
domains: function (args) {
|
||||
return commands.get("open").domains(args);
|
||||
},
|
||||
literal: 0,
|
||||
privateData: true
|
||||
});
|
||||
@@ -1012,9 +1020,13 @@ var Tabs = Module("tabs", {
|
||||
context.anchored = false;
|
||||
context.compare = CompletionContext.Sort.unsorted;
|
||||
context.filters = [CompletionContext.Filter.textDescription];
|
||||
context.keys = { text: function ([i, { state: s }]) (i + 1) + ": " + s.entries[s.index - 1].url,
|
||||
description: "[1].title",
|
||||
icon: "[1].image" };
|
||||
context.keys = {
|
||||
text: function ([i, { state: s }]) {
|
||||
return (i + 1) + ": " + s.entries[s.index - 1].url;
|
||||
},
|
||||
description: "[1].title",
|
||||
icon: "[1].image"
|
||||
};
|
||||
context.completions = tabs.closedTabs.entries();
|
||||
},
|
||||
count: true,
|
||||
|
||||
@@ -365,15 +365,16 @@ var Addons = Module("addons", {
|
||||
|
||||
if (modules.commandline.savingOutput)
|
||||
util.waitFor(() => addons.ready);
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "?",
|
||||
options: [
|
||||
{
|
||||
names: ["-types", "-type", "-t"],
|
||||
description: "The add-on types to list",
|
||||
default: ["extension"],
|
||||
completer: function (context) completion.addonType(context),
|
||||
completer: function (context) {
|
||||
completion.addonType(context);
|
||||
},
|
||||
type: CommandOption.LIST
|
||||
}
|
||||
]
|
||||
@@ -450,7 +451,9 @@ var Addons = Module("addons", {
|
||||
names: ["-types", "-type", "-t"],
|
||||
description: "The add-on types to operate on",
|
||||
default: ["extension"],
|
||||
completer: function (context) completion.addonType(context),
|
||||
completer: function (context) {
|
||||
completion.addonType(context);
|
||||
},
|
||||
type: CommandOption.LIST
|
||||
}
|
||||
]
|
||||
|
||||
@@ -815,7 +815,9 @@ var Buffer = Module("Buffer", {
|
||||
self.saveURI({ uri: uri, file: file, context: elem });
|
||||
},
|
||||
|
||||
completer: function (context) completion.savePage(context, elem)
|
||||
completer: function (context) {
|
||||
completion.savePage(context, elem);
|
||||
}
|
||||
}).open();
|
||||
}
|
||||
catch (e) {
|
||||
@@ -1891,8 +1893,7 @@ var Buffer = Module("Buffer", {
|
||||
.getInterface(Ci.nsIWebBrowserPrint).print(settings, null);
|
||||
|
||||
dactyl.echomsg(_("print.sent"));
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
completer: function (context, args) {
|
||||
@@ -1911,8 +1912,7 @@ var Buffer = Module("Buffer", {
|
||||
dactyl.assert(!arg || opt.validator(opt.parse(arg)),
|
||||
_("error.invalidArgument", arg));
|
||||
buffer.showPageInfo(true, arg);
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "?",
|
||||
completer: function (context) {
|
||||
modules.completion.optionValue(context, "pageinfo", "+", "");
|
||||
@@ -1934,10 +1934,11 @@ var Buffer = Module("Buffer", {
|
||||
options["usermode"] = false;
|
||||
|
||||
window.stylesheetSwitchAll(buffer.focusedFrame, arg);
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "?",
|
||||
completer: function (context) modules.completion.alternateStyleSheet(context),
|
||||
completer: function (context) {
|
||||
modules.completion.alternateStyleSheet(context);
|
||||
},
|
||||
literal: 0
|
||||
});
|
||||
|
||||
@@ -2016,8 +2017,7 @@ var Buffer = Module("Buffer", {
|
||||
doc.contentType, false, null, chosenData,
|
||||
doc.referrer ? window.makeURI(doc.referrer) : null,
|
||||
doc, true);
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
completer: function (context) {
|
||||
@@ -2041,11 +2041,14 @@ var Buffer = Module("Buffer", {
|
||||
|
||||
commands.add(["vie[wsource]"],
|
||||
"View source code of current document",
|
||||
function (args) { buffer.viewSource(args[0], args.bang); },
|
||||
{
|
||||
function (args) {
|
||||
buffer.viewSource(args[0], args.bang);
|
||||
}, {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
completer: function (context) modules.completion.url(context, "bhf")
|
||||
completer: function (context) {
|
||||
modules.completion.url(context, "bhf");
|
||||
}
|
||||
});
|
||||
|
||||
commands.add(["zo[om]"],
|
||||
@@ -2475,7 +2478,9 @@ var Buffer = Module("Buffer", {
|
||||
"string", "UTF-8",
|
||||
{
|
||||
scope: Option.SCOPE_LOCAL,
|
||||
getter: function () buffer.docShell.QueryInterface(Ci.nsIDocCharset).charset,
|
||||
getter: function () {
|
||||
return buffer.docShell.QueryInterface(Ci.nsIDocCharset).charset;
|
||||
},
|
||||
setter: function (val) {
|
||||
if (options["encoding"] == val)
|
||||
return val;
|
||||
@@ -2491,7 +2496,9 @@ var Buffer = Module("Buffer", {
|
||||
});
|
||||
return null;
|
||||
},
|
||||
completer: function (context) completion.charset(context)
|
||||
completer: function (context) {
|
||||
completion.charset(context);
|
||||
}
|
||||
});
|
||||
|
||||
options.add(["iskeyword", "isk"],
|
||||
@@ -2502,7 +2509,7 @@ var Buffer = Module("Buffer", {
|
||||
this.regexp = util.regexp(value);
|
||||
return value;
|
||||
},
|
||||
validator: function (value) RegExp(value)
|
||||
validator: function (value) { return RegExp(value); }
|
||||
});
|
||||
|
||||
options.add(["jumptags", "jt"],
|
||||
@@ -2518,8 +2525,10 @@ var Buffer = Module("Buffer", {
|
||||
vals[k] = update(new String(v), { matcher: DOM.compileMatcher(Option.splitList(v)) });
|
||||
return vals;
|
||||
},
|
||||
validator: function (value) DOM.validateMatcher.call(this, value)
|
||||
&& Object.keys(value).every(v => v.length == 1)
|
||||
validator: function (value) {
|
||||
return DOM.validateMatcher.call(this, value) &&
|
||||
Object.keys(value).every(v => v.length == 1);
|
||||
}
|
||||
});
|
||||
|
||||
options.add(["linenumbers", "ln"],
|
||||
@@ -2591,7 +2600,7 @@ var Buffer = Module("Buffer", {
|
||||
options.add(["scroll", "scr"],
|
||||
"Number of lines to scroll with <C-u> and <C-d> commands",
|
||||
"number", 0,
|
||||
{ validator: function (value) value >= 0 });
|
||||
{ validator: function (value) { return value >= 0; } });
|
||||
|
||||
options.add(["showstatuslinks", "ssli"],
|
||||
"Where to show the destination of the link under the cursor",
|
||||
@@ -2616,7 +2625,9 @@ var Buffer = Module("Buffer", {
|
||||
|
||||
initValue: function () {},
|
||||
|
||||
getter: function getter(value) !prefs.get(this.PREF) ? 1 : value,
|
||||
getter: function getter(value) {
|
||||
return !prefs.get(this.PREF) ? 1 : value;
|
||||
},
|
||||
|
||||
setter: function setter(value) {
|
||||
prefs.set(this.PREF, value > 1);
|
||||
@@ -2624,15 +2635,19 @@ var Buffer = Module("Buffer", {
|
||||
return value;
|
||||
},
|
||||
|
||||
validator: function (value) value > 0
|
||||
validator: function (value) { return value > 0; }
|
||||
});
|
||||
|
||||
options.add(["usermode", "um"],
|
||||
"Show current website without styling defined by the author",
|
||||
"boolean", false,
|
||||
{
|
||||
setter: function (value) buffer.contentViewer.authorStyleDisabled = value,
|
||||
getter: function () buffer.contentViewer.authorStyleDisabled
|
||||
setter: function (value) {
|
||||
return buffer.contentViewer.authorStyleDisabled = value;
|
||||
},
|
||||
getter: function () {
|
||||
return buffer.contentViewer.authorStyleDisabled;
|
||||
}
|
||||
});
|
||||
|
||||
options.add(["yankshort", "ys"],
|
||||
|
||||
@@ -1676,9 +1676,13 @@ var Commands = Module("commands", {
|
||||
// TODO: "E180: invalid complete value: " + arg
|
||||
names: ["-complete", "-C"],
|
||||
description: "The argument completion function",
|
||||
completer: function (context) [[k, ""] for ([k, v] of iter(config.completers))],
|
||||
completer: function (context) {
|
||||
return [[k, ""] for ([k, v] of iter(config.completers))];
|
||||
},
|
||||
type: CommandOption.STRING,
|
||||
validator: function (arg) arg in config.completers || /^custom,/.test(arg)
|
||||
validator: function (arg) {
|
||||
return arg in config.completers || /^custom,/.test(arg);
|
||||
}
|
||||
},
|
||||
{
|
||||
names: ["-description", "-desc", "-d"],
|
||||
@@ -1715,28 +1719,30 @@ var Commands = Module("commands", {
|
||||
],
|
||||
literal: 1,
|
||||
|
||||
serialize: function () Ary(commands.userHives)
|
||||
.filter(h => h.persist)
|
||||
.map(hive => [
|
||||
{
|
||||
command: this.name,
|
||||
bang: true,
|
||||
options: iter([v, typeof cmd[k] == "boolean" ? null : cmd[k]]
|
||||
// FIXME: this map is expressed multiple times
|
||||
for ([k, v] of iter({
|
||||
argCount: "-nargs",
|
||||
bang: "-bang",
|
||||
count: "-count",
|
||||
description: "-description"
|
||||
}))
|
||||
if (cmd[k])).toObject(),
|
||||
arguments: [cmd.name],
|
||||
literalArg: cmd.action,
|
||||
ignoreDefaults: true
|
||||
}
|
||||
for (cmd of hive) if (cmd.persist)
|
||||
])
|
||||
.flatten().array
|
||||
serialize: function () {
|
||||
return Ary(commands.userHives)
|
||||
.filter(h => h.persist)
|
||||
.map(hive => [
|
||||
{
|
||||
command: this.name,
|
||||
bang: true,
|
||||
options: iter([v, typeof cmd[k] == "boolean" ? null : cmd[k]]
|
||||
// FIXME: this map is expressed multiple times
|
||||
for ([k, v] of iter({
|
||||
argCount: "-nargs",
|
||||
bang: "-bang",
|
||||
count: "-count",
|
||||
description: "-description"
|
||||
}))
|
||||
if (cmd[k])).toObject(),
|
||||
arguments: [cmd.name],
|
||||
literalArg: cmd.action,
|
||||
ignoreDefaults: true
|
||||
}
|
||||
for (cmd of hive) if (cmd.persist)
|
||||
])
|
||||
.flatten().array;
|
||||
}
|
||||
});
|
||||
|
||||
commands.add(["delc[ommand]"],
|
||||
@@ -1754,16 +1760,21 @@ var Commands = Module("commands", {
|
||||
}, {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
completer: function (context, args) modules.completion.userCommand(context, args["-group"]),
|
||||
completer: function (context, args) {
|
||||
modules.completion.userCommand(context, args["-group"]);
|
||||
},
|
||||
options: [contexts.GroupFlag("commands")]
|
||||
});
|
||||
|
||||
commands.add(["comp[letions]"],
|
||||
"List the completion results for a given command substring",
|
||||
function (args) { modules.completion.listCompleter("ex", args[0]); },
|
||||
{
|
||||
function (args) {
|
||||
modules.completion.listCompleter("ex", args[0]);
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context, args) modules.completion.ex(context),
|
||||
completer: function (context) {
|
||||
modules.completion.ex(context);
|
||||
},
|
||||
literal: 0
|
||||
});
|
||||
|
||||
@@ -1801,10 +1812,11 @@ var Commands = Module("commands", {
|
||||
|
||||
let lines = res.split("\n").length;
|
||||
dactyl.echomsg(_("command.yank.yankedLine" + (lines == 1 ? "" : "s"), lines));
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) modules.completion[/^:/.test(context.filter) ? "ex" : "javascript"](context),
|
||||
completer: function (context) {
|
||||
modules.completion[/^:/.test(context.filter) ? "ex" : "javascript"](context);
|
||||
},
|
||||
literal: 0
|
||||
});
|
||||
},
|
||||
|
||||
@@ -1224,8 +1224,7 @@ var Completion = Module("completion", {
|
||||
function m(item) {
|
||||
return template.completionRow(item, "CompItem");
|
||||
})]);
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "*",
|
||||
completer: function (context) {
|
||||
let PREFIX = "/ex/contexts";
|
||||
@@ -1303,7 +1302,9 @@ var Completion = Module("completion", {
|
||||
return values;
|
||||
},
|
||||
|
||||
validator: function validator(values) validator.supercall(this, this.setter(values))
|
||||
validator: function validator(values) {
|
||||
return validator.supercall(this, this.setter(values));
|
||||
}
|
||||
});
|
||||
|
||||
options.add(["wildanchor", "wia"],
|
||||
|
||||
@@ -152,7 +152,9 @@ var Contexts = Module("contexts", {
|
||||
contexts.user)[this.name];
|
||||
},
|
||||
|
||||
completer: function (context) modules.completion.group(context)
|
||||
completer: function (context) {
|
||||
modules.completion.group(context);
|
||||
}
|
||||
});
|
||||
|
||||
memoize(modules, "userContext", () => contexts.Context(modules.io.getRCFile("~", true), contexts.user, [modules, false]));
|
||||
@@ -685,8 +687,7 @@ var Contexts = Module("contexts", {
|
||||
!["-description", "-locations", "-nopersist"]
|
||||
.some(hasOwnProperty.bind(null, args.explicitOpts)),
|
||||
_("group.cantModifyBuiltin"));
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
completer: function (context, args) {
|
||||
@@ -718,24 +719,26 @@ var Contexts = Module("contexts", {
|
||||
}
|
||||
],
|
||||
serialGroup: 20,
|
||||
serialize: function () [
|
||||
{
|
||||
command: this.name,
|
||||
bang: true,
|
||||
options: iter([v, typeof group[k] == "boolean" ? null : group[k]]
|
||||
// FIXME: this map is expressed multiple times
|
||||
for ([k, v] of iter({
|
||||
args: "-args",
|
||||
description: "-description",
|
||||
filter: "-locations"
|
||||
}))
|
||||
if (group[k])).toObject(),
|
||||
arguments: [group.name],
|
||||
ignoreDefaults: true
|
||||
}
|
||||
for (group of contexts.initializedGroups())
|
||||
if (!group.builtin && group.persist)
|
||||
].concat([{ command: this.name, arguments: ["user"] }])
|
||||
serialize: function () {
|
||||
return [
|
||||
{
|
||||
command: this.name,
|
||||
bang: true,
|
||||
options: iter([v, typeof group[k] == "boolean" ? null : group[k]]
|
||||
// FIXME: this map is expressed multiple times
|
||||
for ([k, v] of iter({
|
||||
args: "-args",
|
||||
description: "-description",
|
||||
filter: "-locations"
|
||||
}))
|
||||
if (group[k])).toObject(),
|
||||
arguments: [group.name],
|
||||
ignoreDefaults: true
|
||||
}
|
||||
for (group of contexts.initializedGroups())
|
||||
if (!group.builtin && group.persist)
|
||||
].concat([{ command: this.name, arguments: ["user"] }]);
|
||||
}
|
||||
});
|
||||
|
||||
commands.add(["delg[roup]"],
|
||||
@@ -749,8 +752,7 @@ var Contexts = Module("contexts", {
|
||||
util.assert(contexts.getGroup(args[0]), _("group.noSuch", args[0]));
|
||||
contexts.removeGroup(args[0]);
|
||||
}
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
completer: function (context, args) {
|
||||
|
||||
@@ -481,8 +481,7 @@ var Downloads_ = Module("downloads", XPCOM(Ci.nsIDownloadProgressListener), {
|
||||
function (args) {
|
||||
let downloads = DownloadList(modules, args[0], args["-sort"]);
|
||||
modules.commandline.echo(downloads);
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "?",
|
||||
options: [
|
||||
{
|
||||
@@ -492,8 +491,12 @@ var Downloads_ = Module("downloads", XPCOM(Ci.nsIDownloadProgressListener), {
|
||||
get default() {
|
||||
return modules.options["downloadsort"];
|
||||
},
|
||||
completer: function (context, args) modules.options.get("downloadsort").completer(context, { values: args["-sort"] }),
|
||||
validator: function (value) modules.options.get("downloadsort").validator(value)
|
||||
completer: function (context, args) {
|
||||
modules.options.get("downloadsort").completer(context, { values: args["-sort"] });
|
||||
},
|
||||
validator: function (value) {
|
||||
return modules.options.get("downloadsort").validator(value);
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -546,7 +549,9 @@ var Downloads_ = Module("downloads", XPCOM(Ci.nsIDownloadProgressListener), {
|
||||
.flatten().array;
|
||||
},
|
||||
|
||||
has: function () Array.some(arguments, val => this.value.some(v => v.substr(1) == val)),
|
||||
has: function () {
|
||||
return Array.some(arguments, val => this.value.some(v => v.substr(1) == val));
|
||||
},
|
||||
|
||||
validator: function (value) {
|
||||
let seen = new RealSet();
|
||||
|
||||
@@ -429,7 +429,9 @@ var Help = Module("Help", {
|
||||
}, {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
completer: function (context) completion.help(context, consolidated),
|
||||
completer: function (context) {
|
||||
completion.help(context, consolidated);
|
||||
},
|
||||
literal: 0
|
||||
});
|
||||
});
|
||||
|
||||
@@ -332,10 +332,11 @@ var Highlights = Module("Highlight", {
|
||||
dactyl.assert(lastScheme, _("command.colorscheme.notFound", scheme));
|
||||
}
|
||||
autocommands.trigger("ColorScheme", { name: scheme });
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) completion.colorScheme(context)
|
||||
completer: function (context) {
|
||||
completion.colorScheme(context);
|
||||
}
|
||||
});
|
||||
|
||||
commands.add(["hi[ghlight]"],
|
||||
@@ -381,8 +382,7 @@ var Highlights = Module("Highlight", {
|
||||
highlight.set(key, css, clear, "-append" in args, args["-link"]);
|
||||
else
|
||||
util.assert(false, _("error.invalidArgument"));
|
||||
},
|
||||
{
|
||||
}, {
|
||||
// TODO: add this as a standard highlight completion function?
|
||||
completer: function (context, args) {
|
||||
// Complete a highlight group on :hi clear ...
|
||||
@@ -420,18 +420,20 @@ var Highlights = Module("Highlight", {
|
||||
}
|
||||
}
|
||||
],
|
||||
serialize: function () [
|
||||
{
|
||||
command: this.name,
|
||||
arguments: [v.class],
|
||||
literalArg: v.value,
|
||||
options: {
|
||||
"-link": v.extends.length ? v.extends : undefined
|
||||
serialize: function () {
|
||||
return [
|
||||
{
|
||||
command: this.name,
|
||||
arguments: [v.class],
|
||||
literalArg: v.value,
|
||||
options: {
|
||||
"-link": v.extends.length ? v.extends : undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
for (v of highlight)
|
||||
if (v.value != v.defaultValue)
|
||||
]
|
||||
for (v of highlight)
|
||||
if (v.value != v.defaultValue)
|
||||
];
|
||||
}
|
||||
});
|
||||
},
|
||||
completion: function initCompletion(dactyl, modules) {
|
||||
|
||||
@@ -650,7 +650,9 @@ var IO = Module("io", {
|
||||
}
|
||||
}, {
|
||||
argCount: "?",
|
||||
completer: function (context) completion.directory(context, true),
|
||||
completer: function (context) {
|
||||
completion.directory(context, true);
|
||||
},
|
||||
literal: 0
|
||||
});
|
||||
|
||||
@@ -689,7 +691,9 @@ var IO = Module("io", {
|
||||
}, {
|
||||
argCount: "*", // FIXME: should be "?" but kludged for proper error message
|
||||
bang: true,
|
||||
completer: function (context) completion.file(context, true)
|
||||
completer: function (context) {
|
||||
completion.file(context, true);
|
||||
}
|
||||
});
|
||||
|
||||
commands.add(["mkv[imruntime]"],
|
||||
@@ -889,17 +893,22 @@ unlet s:cpo_save
|
||||
}, {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
completer: function (context) completion.directory(context, true),
|
||||
completer: function (context) {
|
||||
completion.directory(context, true);
|
||||
},
|
||||
literal: 1
|
||||
});
|
||||
|
||||
commands.add(["runt[ime]"],
|
||||
"Source the specified file from each directory in 'runtimepath'",
|
||||
function (args) { io.sourceFromRuntimePath(args, args.bang); },
|
||||
{
|
||||
function (args) {
|
||||
io.sourceFromRuntimePath(args, args.bang);
|
||||
}, {
|
||||
argCount: "+",
|
||||
bang: true,
|
||||
completer: function (context) completion.runtime(context)
|
||||
completer: function (context) {
|
||||
completion.runtime(context);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -927,7 +936,9 @@ unlet s:cpo_save
|
||||
}, {
|
||||
argCount: "+", // FIXME: should be "1" but kludged for proper error message
|
||||
bang: true,
|
||||
completer: function (context) completion.file(context, true)
|
||||
completer: function (context) {
|
||||
completion.file(context, true);
|
||||
}
|
||||
});
|
||||
|
||||
commands.add(["!", "run"],
|
||||
@@ -969,7 +980,9 @@ unlet s:cpo_save
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
// This is abominably slow.
|
||||
// completer: function (context) completion.shellCommand(context),
|
||||
//completer: function (context) {
|
||||
// completion.shellCommand(context);
|
||||
//},
|
||||
literal: 0
|
||||
});
|
||||
},
|
||||
@@ -1156,10 +1169,15 @@ unlet s:cpo_save
|
||||
|
||||
options.add(["fileencoding", "fenc"],
|
||||
"The character encoding used when reading and writing files",
|
||||
"string", "UTF-8", {
|
||||
completer: function (context) completion.charset(context),
|
||||
getter: function () File.defaultEncoding,
|
||||
setter: function (value) (File.defaultEncoding = value)
|
||||
"string", "UTF-8",
|
||||
{
|
||||
completer: function (context) {
|
||||
completion.charset(context);
|
||||
},
|
||||
getter: function () { return File.defaultEncoding; },
|
||||
setter: function (value) {
|
||||
return File.defaultEncoding = value;
|
||||
}
|
||||
});
|
||||
options.add(["cdpath", "cd"],
|
||||
"List of directories searched when executing :cd",
|
||||
@@ -1169,7 +1187,9 @@ unlet s:cpo_save
|
||||
return this.value.map(path => File(path, modules.io.cwd))
|
||||
.filter(dir => dir.exists());
|
||||
},
|
||||
setter: function (value) File.expandPathList(value)
|
||||
setter: function (value) {
|
||||
return File.expandPathList(value);
|
||||
}
|
||||
});
|
||||
|
||||
options.add(["runtimepath", "rtp"],
|
||||
@@ -1185,7 +1205,7 @@ unlet s:cpo_save
|
||||
options.add(["shell", "sh"],
|
||||
"Shell to use for executing external commands with :! and :run",
|
||||
"string", shell,
|
||||
{ validator: function (val) io.pathSearch(val) });
|
||||
{ validator: function (val) { return io.pathSearch(val); } });
|
||||
|
||||
options.add(["shellcmdflag", "shcf"],
|
||||
"Flag passed to shell when executing external commands with :! and :run",
|
||||
|
||||
@@ -860,7 +860,9 @@ var JavaScript = Module("javascript", {
|
||||
}, {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
completer: function (context) modules.completion.javascript(context),
|
||||
completer: function (context) {
|
||||
modules.completion.javascript(context);
|
||||
},
|
||||
hereDoc: true,
|
||||
literal: 0
|
||||
});
|
||||
|
||||
@@ -1418,15 +1418,17 @@ var Options = Module("options", {
|
||||
description: "Set an option",
|
||||
modifiers: {},
|
||||
extra: {
|
||||
serialize: function () [
|
||||
{
|
||||
command: this.name,
|
||||
literalArg: [opt.type == "boolean" ? (opt.value ? "" : "no") + opt.name
|
||||
: opt.name + "=" + opt.stringValue]
|
||||
}
|
||||
for (opt of modules.options)
|
||||
if (!opt.getter && !opt.isDefault && (opt.scope & Option.SCOPE_GLOBAL))
|
||||
]
|
||||
serialize: function () {
|
||||
return [
|
||||
{
|
||||
command: this.name,
|
||||
literalArg: [opt.type == "boolean" ? (opt.value ? "" : "no") + opt.name
|
||||
: opt.name + "=" + opt.stringValue]
|
||||
}
|
||||
for (opt of modules.options)
|
||||
if (!opt.getter && !opt.isDefault && (opt.scope & Option.SCOPE_GLOBAL))
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
].forEach(function (params) {
|
||||
|
||||
@@ -507,15 +507,14 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
else
|
||||
sanitize(items);
|
||||
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "*", // FIXME: should be + and 0
|
||||
bang: true,
|
||||
completer: function (context) {
|
||||
context.title = ["Privacy Item", "Description"];
|
||||
context.completions = modules.options.get("sanitizeitems").values;
|
||||
},
|
||||
domains: function (args) args["-host"] || [],
|
||||
domains: function (args) { return args["-host"] || []; },
|
||||
options: [
|
||||
{
|
||||
names: ["-host", "-h"],
|
||||
@@ -533,9 +532,13 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
}, {
|
||||
names: ["-timespan", "-t"],
|
||||
description: "Timespan for which to sanitize items",
|
||||
completer: function (context) modules.options.get("sanitizetimespan").completer(context),
|
||||
completer: function (context) {
|
||||
modules.options.get("sanitizetimespan").completer(context);
|
||||
},
|
||||
type: modules.CommandOption.STRING,
|
||||
validator: function (arg) modules.options.get("sanitizetimespan").validator(arg)
|
||||
validator: function (arg) {
|
||||
return modules.options.get("sanitizetimespan").validator(arg);
|
||||
}
|
||||
}
|
||||
],
|
||||
privateData: true
|
||||
@@ -645,8 +648,10 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
return res && !/^!/.test(res);
|
||||
},
|
||||
|
||||
validator: function (values) values.length &&
|
||||
values.every(val => (val === "all" || hasOwnProperty(sanitizer.itemMap, val.replace(/^!/, ""))))
|
||||
validator: function (values) {
|
||||
return values.length &&
|
||||
values.every(val => (val === "all" || hasOwnProperty(sanitizer.itemMap, val.replace(/^!/, ""))));
|
||||
}
|
||||
});
|
||||
|
||||
options.add(["sanitizeshutdown", "ss"],
|
||||
@@ -712,7 +717,9 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
["none", "Accept no cookies"],
|
||||
["visited", "Accept cookies from visited sites"]
|
||||
],
|
||||
getter: function () (this.values[prefs.get(this.PREF)] || ["all"])[0],
|
||||
getter: function () {
|
||||
return (this.values[prefs.get(this.PREF)] || ["all"])[0];
|
||||
},
|
||||
setter: function (val) {
|
||||
prefs.set(this.PREF, this.values.map(i => i[0]).indexOf(val));
|
||||
return val;
|
||||
@@ -731,7 +738,9 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
["prompt", "Always prompt for a lifetime"],
|
||||
["session", "The current session"]
|
||||
],
|
||||
getter: function () (this.values[prefs.get(this.PREF)] || [prefs.get(this.PREF_DAYS)])[0],
|
||||
getter: function () {
|
||||
return (this.values[prefs.get(this.PREF)] || [prefs.get(this.PREF_DAYS)])[0];
|
||||
},
|
||||
setter: function (value) {
|
||||
let val = this.values.map(i => i[0]).indexOf(value);
|
||||
if (val > -1)
|
||||
@@ -743,7 +752,10 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
},
|
||||
initialValue: true,
|
||||
persist: false,
|
||||
validator: function validator(val) parseInt(val) == val || validator.superapply(this, arguments)
|
||||
validator: function validator(val) {
|
||||
return parseInt(val) == val ||
|
||||
validator.superapply(this, arguments);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -628,8 +628,7 @@ var Styles = Module("Styles", {
|
||||
if (args["-nopersist"] || !args["-append"] || style.persist === undefined)
|
||||
style.persist = !args["-nopersist"];
|
||||
}
|
||||
},
|
||||
{
|
||||
}, {
|
||||
completer: function (context, args) {
|
||||
let sheet = args["-group"].get(args["-name"]);
|
||||
if (args.completeArg == 0) {
|
||||
@@ -654,8 +653,8 @@ var Styles = Module("Styles", {
|
||||
nameFlag(),
|
||||
{ names: ["-nopersist", "-N"], description: "Do not save this style to an auto-generated RC file" }
|
||||
],
|
||||
serialize: function ()
|
||||
Ary(styles.hives)
|
||||
serialize: function () {
|
||||
return Ary(styles.hives)
|
||||
.filter(hive => hive.persist)
|
||||
.map(hive =>
|
||||
hive.sheets.filter(style => style.persist)
|
||||
@@ -670,7 +669,8 @@ var Styles = Module("Styles", {
|
||||
"-name": style.name || undefined
|
||||
}
|
||||
})))
|
||||
.flatten().array
|
||||
.flatten().array;
|
||||
}
|
||||
});
|
||||
|
||||
[
|
||||
|
||||
@@ -242,10 +242,11 @@ const Config = Module("config", ConfigBase, {
|
||||
let arg = args.literalArg;
|
||||
dactyl.assert(arg in Config.displayPanes, _("error.invalidArgument", arg));
|
||||
config.closeDisplayPane(Config.displayPanes[arg]);
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) completion.displayPane(context),
|
||||
completer: function (context) {
|
||||
completion.displayPane(context);
|
||||
},
|
||||
literal: 0
|
||||
});
|
||||
|
||||
@@ -257,10 +258,11 @@ const Config = Module("config", ConfigBase, {
|
||||
dactyl.assert(arg in Config.displayPanes, _("error.invalidArgument", arg));
|
||||
// TODO: focus when we have better key handling of these extended modes
|
||||
config.openDisplayPane(Config.displayPanes[arg]);
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) completion.displayPane(context),
|
||||
completer: function (context) {
|
||||
completion.displayPane(context);
|
||||
},
|
||||
literal: 0
|
||||
});
|
||||
|
||||
@@ -316,7 +318,7 @@ const Config = Module("config", ConfigBase, {
|
||||
prefs.set("browser.offline", ioService.offline);
|
||||
return value;
|
||||
},
|
||||
getter: function () !services.io.offline
|
||||
getter: function () { return !services.io.offline; }
|
||||
});
|
||||
},
|
||||
services: function initServices(dactyl, modules, window) {
|
||||
|
||||
@@ -486,11 +486,12 @@ const Player = Module("player", {
|
||||
"chrome://songbird/content/mediapages/filtersPage.xul");
|
||||
// TODO: make this player.focusTrack work ?
|
||||
player.focusTrack(view.getItemByIndex(0));
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "1",
|
||||
literal: 0
|
||||
//completer: function (context, args) completion.tracks(context, args);
|
||||
//completer: function (context, args) {
|
||||
// completion.tracks(context, args);
|
||||
//}
|
||||
});
|
||||
|
||||
commands.add(["load"],
|
||||
@@ -513,10 +514,11 @@ const Player = Module("player", {
|
||||
// load main library if there are no args
|
||||
_SBShowMainLibrary();
|
||||
}
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "?",
|
||||
completer: function (context, args) completion.playlist(context),
|
||||
completer: function (context) {
|
||||
completion.playlist(context);
|
||||
},
|
||||
literal: 0
|
||||
});
|
||||
|
||||
@@ -595,10 +597,11 @@ const Player = Module("player", {
|
||||
}
|
||||
dactyl.echoerr(_("error.invalidArgument", arg));
|
||||
}
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) completion.mediaView(context),
|
||||
completer: function (context) {
|
||||
completion.mediaView(context);
|
||||
},
|
||||
literal: 0
|
||||
});
|
||||
|
||||
@@ -606,17 +609,22 @@ const Player = Module("player", {
|
||||
"Sort the current media view",
|
||||
function (args) {
|
||||
player.sortBy(args[0], args["-order"] == "up");
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) completion.mediaListSort(context),
|
||||
completer: function (context) {
|
||||
completion.mediaListSort(context);
|
||||
},
|
||||
options: [
|
||||
{
|
||||
names: ["-order", "-o"], type: CommandOption.STRING,
|
||||
default: "up",
|
||||
description: "Specify the sorting order of the given field",
|
||||
validator: function (arg) /^(up|down)$/.test(arg),
|
||||
completer: function () [["up", "Sort in ascending order"], ["down", "Sort in descending order"]]
|
||||
validator: function (arg) {
|
||||
return /^(up|down)$/.test(arg);
|
||||
},
|
||||
completer: function () {
|
||||
return [["up", "Sort in ascending order"], ["down", "Sort in descending order"]];
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -645,8 +653,7 @@ const Player = Module("player", {
|
||||
gMM.sequencer.playView(mainView,
|
||||
mainView.getIndexForItem(library.getItemsByProperties(properties).queryElementAt(0, Ci.sbIMediaItem)));
|
||||
player.focusPlayingTrack();
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "+",
|
||||
completer: function (context, args) {
|
||||
if (args.completeArg == 0)
|
||||
@@ -815,21 +822,29 @@ const Player = Module("player", {
|
||||
"Set the playback repeat mode",
|
||||
"number", 0,
|
||||
{
|
||||
setter: function (value) gMM.sequencer.repeatMode = value,
|
||||
getter: function () gMM.sequencer.repeatMode,
|
||||
completer: function (context) [
|
||||
["0", "Repeat none"],
|
||||
["1", "Repeat one"],
|
||||
["2", "Repeat all"]
|
||||
]
|
||||
setter: function (value) {
|
||||
return gMM.sequencer.repeatMode = value;
|
||||
},
|
||||
getter: function () { return gMM.sequencer.repeatMode; },
|
||||
completer: function () {
|
||||
return [
|
||||
["0", "Repeat none"],
|
||||
["1", "Repeat one"],
|
||||
["2", "Repeat all"]
|
||||
];
|
||||
}
|
||||
});
|
||||
|
||||
options.add(["shuffle"],
|
||||
"Play tracks in shuffled order",
|
||||
"boolean", false,
|
||||
{
|
||||
setter: function (value) gMM.sequencer.mode = value ? gMM.sequencer.MODE_SHUFFLE : gMM.sequencer.MODE_FORWARD,
|
||||
getter: function () gMM.sequencer.mode == gMM.sequencer.MODE_SHUFFLE
|
||||
setter: function (value) {
|
||||
return gMM.sequencer.mode = value ? gMM.sequencer.MODE_SHUFFLE : gMM.sequencer.MODE_FORWARD;
|
||||
},
|
||||
getter: function () {
|
||||
return gMM.sequencer.mode == gMM.sequencer.MODE_SHUFFLE;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -153,13 +153,12 @@ var Config = Module("config", ConfigBase, {
|
||||
}
|
||||
|
||||
return dactyl.echoerr(_("error.invalidArgument", args[0]));
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
completer: function (context) {
|
||||
context.ignoreCase = true;
|
||||
return completion.sidebar(context);
|
||||
completion.sidebar(context);
|
||||
},
|
||||
literal: 0
|
||||
});
|
||||
@@ -171,10 +170,9 @@ var Config = Module("config", ConfigBase, {
|
||||
this.forceTarget = dactyl.NEW_WINDOW;
|
||||
this.execute(args[0], null, true);
|
||||
});
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) completion.ex(context),
|
||||
completer: function (context) { completion.ex(context); },
|
||||
literal: 0,
|
||||
subCommand: 0
|
||||
});
|
||||
@@ -191,10 +189,11 @@ var Config = Module("config", ConfigBase, {
|
||||
dactyl.open(args[0], dactyl.NEW_WINDOW);
|
||||
else
|
||||
dactyl.open("about:blank", dactyl.NEW_WINDOW);
|
||||
},
|
||||
{
|
||||
completer: function (context) completion.url(context),
|
||||
domains: function (args) commands.get("open").domains(args),
|
||||
}, {
|
||||
completer: function (context) { completion.url(context); },
|
||||
domains: function (args) {
|
||||
return commands.get("open").domains(args);
|
||||
},
|
||||
literal: 0,
|
||||
privateData: true
|
||||
});
|
||||
@@ -242,7 +241,7 @@ var Config = Module("config", ConfigBase, {
|
||||
window.BrowserOffline.toggleOfflineStatus();
|
||||
return value;
|
||||
},
|
||||
getter: function () !services.io.offline
|
||||
getter: function () { return !services.io.offline; }
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -164,7 +164,9 @@ var Config = Module("config", ConfigBase, {
|
||||
window.MailOfflineMgr.toggleOfflineStatus();
|
||||
return value;
|
||||
},
|
||||
getter: function () window.MailOfflineMgr.isOnline()
|
||||
getter: function () {
|
||||
return window.MailOfflineMgr.isOnline();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -405,10 +405,11 @@ var Mail = Module("mail", {
|
||||
MsgOpenNewTabForFolder(folder.URI);
|
||||
else
|
||||
SelectFolder(folder.URI);
|
||||
},
|
||||
{
|
||||
}, {
|
||||
argCount: "?",
|
||||
completer: function (context) completion.mailFolder(context),
|
||||
completer: function (context) {
|
||||
completion.mailFolder(context);
|
||||
},
|
||||
count: true,
|
||||
literal: 0
|
||||
});
|
||||
@@ -449,19 +450,25 @@ var Mail = Module("mail", {
|
||||
|
||||
commands.add(["copy[to]"],
|
||||
"Copy selected messages",
|
||||
function (args) { mail._moveOrCopy(true, args.literalArg); },
|
||||
{
|
||||
function (args) {
|
||||
mail._moveOrCopy(true, args.literalArg);
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) completion.mailFolder(context),
|
||||
completer: function (context) {
|
||||
completion.mailFolder(context);
|
||||
},
|
||||
literal: 0
|
||||
});
|
||||
|
||||
commands.add(["move[to]"],
|
||||
"Move selected messages",
|
||||
function (args) { mail._moveOrCopy(false, args.literalArg); },
|
||||
{
|
||||
function (args) {
|
||||
mail._moveOrCopy(false, args.literalArg);
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) completion.mailFolder(context),
|
||||
completer: function (context) {
|
||||
completion.mailFolder(context);
|
||||
},
|
||||
literal: 0
|
||||
});
|
||||
|
||||
@@ -875,7 +882,9 @@ var Mail = Module("mail", {
|
||||
"Set the archive folder",
|
||||
"string", "Archive",
|
||||
{
|
||||
completer: function (context) completion.mailFolder(context)
|
||||
completer: function (context) {
|
||||
completion.mailFolder(context);
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: generate the possible values dynamically from the menu
|
||||
@@ -893,25 +902,29 @@ var Mail = Module("mail", {
|
||||
|
||||
return value;
|
||||
},
|
||||
completer: function (context) [
|
||||
["inherit", "Default View"], // FIXME: correct description?
|
||||
["classic", "Classic View"],
|
||||
["wide", "Wide View"],
|
||||
["vertical", "Vertical View"]
|
||||
]
|
||||
completer: function () {
|
||||
return [
|
||||
["inherit", "Default View"], // FIXME: correct description?
|
||||
["classic", "Classic View"],
|
||||
["wide", "Wide View"],
|
||||
["vertical", "Vertical View"]
|
||||
];
|
||||
}
|
||||
});
|
||||
|
||||
options.add(["smtpserver", "smtp"],
|
||||
"Set the default SMTP server",
|
||||
"string", services.smtp.defaultServer.key, // TODO: how should we handle these persistent external defaults - "inherit" or null?
|
||||
{
|
||||
getter: function () services.smtp.defaultServer.key,
|
||||
getter: function () { return services.smtp.defaultServer.key; },
|
||||
setter: function (value) {
|
||||
let server = mail.smtpServers.filter(s => s.key == value)[0];
|
||||
services.smtp.defaultServer = server;
|
||||
return value;
|
||||
},
|
||||
completer: function (context) [[s.key, s.serverURI] for ([, s] in Iterator(mail.smtpServers))]
|
||||
completer: function () {
|
||||
return [[s.key, s.serverURI] for ([, s] in Iterator(mail.smtpServers))];
|
||||
}
|
||||
});
|
||||
|
||||
/*options.add(["threads"],
|
||||
|
||||
Reference in New Issue
Block a user