mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 03:47:57 +01:00
Dont use argCount with literal. Use the default favicon in :ls
This commit is contained in:
@@ -27,6 +27,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
||||
}}} ***** END LICENSE BLOCK *****/
|
||||
|
||||
// TODO: with the new subscript loader, is there really no way to keep variable in per-file scope?
|
||||
// Not really. --Kris
|
||||
const DEFAULT_FAVICON = "chrome://mozapps/skin/places/defaultFavicon.png";
|
||||
|
||||
// also includes methods for dealing with keywords and search engines
|
||||
@@ -339,7 +340,7 @@ function Bookmarks() //{{{
|
||||
},
|
||||
{
|
||||
completer: function completer(context) completion.bookmark(context),
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
@@ -667,7 +668,7 @@ function History() //{{{
|
||||
return [0, completions];
|
||||
},
|
||||
count: true,
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
commands.add(["fo[rward]", "fw"],
|
||||
@@ -719,7 +720,7 @@ function History() //{{{
|
||||
return [0, completions];
|
||||
},
|
||||
count: true,
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
commands.add(["hist[ory]", "hs"],
|
||||
@@ -727,7 +728,7 @@ function History() //{{{
|
||||
function (args) { history.list(args.string, args.bang); },
|
||||
{
|
||||
bang: true,
|
||||
literal: true,
|
||||
literal: 0,
|
||||
completer: function (context) completion.history(context)
|
||||
// completer: function (filter) completion.history(filter)
|
||||
});
|
||||
|
||||
@@ -521,7 +521,7 @@ function Buffer() //{{{
|
||||
},
|
||||
{
|
||||
completer: function (context) completion.alternateStylesheet(context),
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
commands.add(["re[load]"],
|
||||
|
||||
@@ -86,7 +86,7 @@ function Command(specs, description, action, extraInfo) //{{{
|
||||
this.options = extraInfo.options || [];
|
||||
this.bang = extraInfo.bang || false;
|
||||
this.count = extraInfo.count || false;
|
||||
this.literal = extraInfo.literal || false;
|
||||
this.literal = extraInfo.literal == null ? null : extraInfo.literal;
|
||||
this.serial = extraInfo.serial;
|
||||
|
||||
this.isUserCommand = extraInfo.isUserCommand || false;
|
||||
@@ -413,29 +413,6 @@ function Commands() //{{{
|
||||
if (!options)
|
||||
options = [];
|
||||
|
||||
if (literal)
|
||||
/*
|
||||
TODO: This change doesn't seem right to me. It no longer
|
||||
supports "?" which is really the only non-integer argCount
|
||||
that makes much sense with a literal arg. Likewise, it no
|
||||
longer supports "*" which we can allow and treat as "?" - "+"
|
||||
as "1". I also don't like having argCounts > 1 specified as
|
||||
integers and those below as strings, even if the former are
|
||||
currently only used with 'literal'. I might be missing
|
||||
something? -- djk
|
||||
|
||||
The reason I chose "+" was that some functions were already
|
||||
using it when they expected a literal arg. "?" probably makes
|
||||
more sense. I changed it to integers only in the cases where
|
||||
literal is used, because then it has a different meaning, i.e.,
|
||||
if we have this many args, push the rest of the string into the
|
||||
last arg, bug don't worry whether we actually have that many
|
||||
args. Using strings gave the wrong results, because "1" died
|
||||
if you didn't have 1 arg, but "2" didn't die if you didn't have
|
||||
2. Perhaps it should have a separate option. --Kris
|
||||
*/
|
||||
var literalIndex = argCount == "+" ? 0 : Math.max(argCount - 1, 0);
|
||||
|
||||
if (!argCount)
|
||||
argCount = "*";
|
||||
|
||||
@@ -599,7 +576,7 @@ function Commands() //{{{
|
||||
complete.highlight(i, sub.length, "SPELLCHECK")
|
||||
}
|
||||
|
||||
if (literal && args.length == literalIndex)
|
||||
if (args.length == literal)
|
||||
{
|
||||
if (complete)
|
||||
args.completeArg = args.length;
|
||||
@@ -660,7 +637,7 @@ function Commands() //{{{
|
||||
|
||||
// check for correct number of arguments
|
||||
if (args.length == 0 && /^[1+]$/.test(argCount) ||
|
||||
literal && argCount == "+" && /^\s*$/.test(args.literalArg))
|
||||
literal != null && /[+?]/.test(argCount) && !/\S/.test(args.literalArg || ""))
|
||||
{
|
||||
if (!complete)
|
||||
{
|
||||
@@ -855,7 +832,6 @@ function Commands() //{{{
|
||||
}
|
||||
},
|
||||
{
|
||||
argCount: 2,
|
||||
bang: true,
|
||||
completer: function (context) completion.userCommand(context),
|
||||
options: [
|
||||
@@ -866,7 +842,7 @@ function Commands() //{{{
|
||||
[["-complete"], commandManager.OPTION_STRING,
|
||||
function (arg) arg in completeOptionMap || /custom,\w+/.test(arg)]
|
||||
],
|
||||
literal: true,
|
||||
literal: 1,
|
||||
serial: function () [
|
||||
{
|
||||
command: this.name,
|
||||
|
||||
@@ -1150,9 +1150,10 @@ function Completion() //{{{
|
||||
context.title = ["Buffer", "URL"];
|
||||
context.keys = { text: "text", description: "url", icon: "icon" };
|
||||
let process = context.process[0];
|
||||
context.process = [function ({ text: text, item: item }) <>
|
||||
<span highlight="Indicator" style="display: inline-block; width: 1.5em; text-align: center">{item.indicator}</span>
|
||||
{ process.call(this, { item: item, text: text }) }
|
||||
context.process = [function (item)
|
||||
<>
|
||||
<span highlight="Indicator" style="display: inline-block; width: 1.5em; text-align: center">{item.item.indicator}</span>
|
||||
{ process.call(this, item) }
|
||||
</>];
|
||||
|
||||
context.completions = util.map(tabs.browsers, function ([i, browser]) {
|
||||
@@ -1171,7 +1172,7 @@ function Completion() //{{{
|
||||
text: [i + ": " + (tab.label || "(Untitled)"), i + ": " + url],
|
||||
url: url,
|
||||
indicator: indicator,
|
||||
icon: tab.image
|
||||
icon: tab.image || DEFAULT_FAVICON
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
@@ -173,8 +173,7 @@ function Editor() //{{{
|
||||
editor.listAbbreviations(mode, lhs || "");
|
||||
},
|
||||
{
|
||||
argCount: 2,
|
||||
literal: true,
|
||||
literal: 1,
|
||||
serial: function () [
|
||||
{
|
||||
command: this.name,
|
||||
|
||||
@@ -103,10 +103,9 @@ function AutoCommands() //{{{
|
||||
}
|
||||
},
|
||||
{
|
||||
argCount: 3,
|
||||
bang: true,
|
||||
completer: function (context) completion.autocmdEvent(context),
|
||||
literal: true
|
||||
literal: 2
|
||||
});
|
||||
|
||||
// TODO: expand target to all buffers
|
||||
@@ -118,7 +117,7 @@ function AutoCommands() //{{{
|
||||
},
|
||||
{
|
||||
completer: function (context) completion.autocmdEvent(context),
|
||||
literal: true
|
||||
literal: 0
|
||||
}
|
||||
);
|
||||
|
||||
@@ -156,7 +155,7 @@ function AutoCommands() //{{{
|
||||
},
|
||||
{
|
||||
completer: function (context) completion.autocmdEvent(context),
|
||||
literal: true
|
||||
literal: 0
|
||||
}
|
||||
);
|
||||
|
||||
@@ -710,7 +709,7 @@ function Events() //{{{
|
||||
{
|
||||
bang: true,
|
||||
completer: function (context) completion.macro(context),
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
commands.add(["macros"],
|
||||
|
||||
@@ -234,7 +234,7 @@ function IO() //{{{
|
||||
{
|
||||
argCount: "+", // FIXME: "?"
|
||||
completer: function (context) completion.file(context, true),
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
// NOTE: this command is only used in :source
|
||||
@@ -366,7 +366,7 @@ function IO() //{{{
|
||||
{
|
||||
bang: true,
|
||||
completer: function (context) completion.shellCommand(context),
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
|
||||
@@ -274,7 +274,7 @@ const liberator = (function () //{{{
|
||||
context.keys = { text: "fullMenuPath", description: "label" };
|
||||
context.completions = getMenuItems();
|
||||
},
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
commands.add(["exe[cute]"],
|
||||
@@ -321,7 +321,7 @@ const liberator = (function () //{{{
|
||||
{
|
||||
bang: true,
|
||||
completer: function (context) completion.help(context),
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
commands.add(["javas[cript]", "js"],
|
||||
@@ -350,7 +350,7 @@ const liberator = (function () //{{{
|
||||
bang: true,
|
||||
completer: function (context) completion.javascript(context),
|
||||
hereDoc: true,
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
commands.add(["loadplugins", "lpl"],
|
||||
@@ -487,7 +487,7 @@ const liberator = (function () //{{{
|
||||
return completion.javascript(context);
|
||||
},
|
||||
count: true,
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
commands.add(["ve[rsion]"],
|
||||
|
||||
@@ -185,12 +185,11 @@ function Mappings() //{{{
|
||||
modeDescription = modeDescription ? " in " + modeDescription + " mode" : "";
|
||||
|
||||
const opts = {
|
||||
argCount: 2,
|
||||
completer: function (context, args) completion.userMapping(context, args, modes),
|
||||
options: [
|
||||
[["<silent>", "<Silent>"], commands.OPTION_NOARG]
|
||||
],
|
||||
literal: true,
|
||||
literal: 1,
|
||||
serial: function () {
|
||||
let noremap = this.name.indexOf("noremap") > -1;
|
||||
return [
|
||||
|
||||
@@ -525,7 +525,7 @@ function Options() //{{{
|
||||
{
|
||||
return commands.get("set").completer(context.filter, args.bang, args.count, { scope: options.OPTION_SCOPE_LOCAL });
|
||||
},
|
||||
literal: true
|
||||
literal: 0
|
||||
}
|
||||
);
|
||||
|
||||
@@ -542,7 +542,7 @@ function Options() //{{{
|
||||
{
|
||||
return commands.get("set").completer(context.filter, args.bang, args.count, { scope: options.OPTION_SCOPE_GLOBAL });
|
||||
},
|
||||
literal: true
|
||||
literal: 0
|
||||
}
|
||||
);
|
||||
|
||||
@@ -717,7 +717,7 @@ function Options() //{{{
|
||||
|
||||
completion.optionValue(context, opt.name, opt.operator);
|
||||
},
|
||||
literal: true,
|
||||
literal: 0,
|
||||
serial: function () [
|
||||
{
|
||||
command: this.name,
|
||||
|
||||
@@ -414,7 +414,7 @@ liberator.registerObserver("load_commands", function ()
|
||||
liberator.echoerr("E185: Cannot find color scheme " + scheme);
|
||||
},
|
||||
{
|
||||
argCount: 1,
|
||||
argCount: "1",
|
||||
completer: function (context) completion.colorScheme(context)
|
||||
});
|
||||
|
||||
@@ -453,7 +453,6 @@ liberator.registerObserver("load_commands", function ()
|
||||
}
|
||||
},
|
||||
{
|
||||
argCount: 2,
|
||||
bang: true,
|
||||
completer: function (context, args) {
|
||||
let compl = [];
|
||||
@@ -475,7 +474,7 @@ liberator.registerObserver("load_commands", function ()
|
||||
}
|
||||
},
|
||||
hereDoc: true,
|
||||
literal: true,
|
||||
literal: 1,
|
||||
options: [[["-name", "-n"], commands.OPTION_STRING, null, function () [[k, v.css] for ([k, v] in Iterator(styles.userNames))]],
|
||||
[["-append", "-a"], commands.OPTION_NOARG]],
|
||||
serial: function () [
|
||||
@@ -495,9 +494,8 @@ liberator.registerObserver("load_commands", function ()
|
||||
styles.removeSheet(args["-name"], args[0], args.literalArg, args["-index"], false);
|
||||
},
|
||||
{
|
||||
argCount: 2,
|
||||
completer: function (context) { context.completions = styles.sites.map(function (site) [site, ""]); },
|
||||
literal: true,
|
||||
literal: 1,
|
||||
options: [[["-index", "-i"], commands.OPTION_INT, null, function () [[i, <>{s.sites.join(",")}: {s.css.replace("\n", "\\n")}</>] for ([i, s] in styles.userSheets)]],
|
||||
[["-name", "-n"], commands.OPTION_STRING, null, function () [[k, v.css] for ([k, v] in Iterator(styles.userNames))]]]
|
||||
});
|
||||
@@ -533,7 +531,6 @@ liberator.registerObserver("load_commands", function ()
|
||||
liberator.echoerr(error);
|
||||
},
|
||||
{
|
||||
argCount: 2,
|
||||
bang: true,
|
||||
// TODO: add this as a standard highlight completion function?
|
||||
completer: function (context, args)
|
||||
@@ -548,7 +545,7 @@ liberator.registerObserver("load_commands", function ()
|
||||
}
|
||||
},
|
||||
hereDoc: true,
|
||||
literal: true,
|
||||
literal: 1,
|
||||
options: [[["-append", "-a"], commands.OPTION_NOARG]],
|
||||
serial: function () [
|
||||
{
|
||||
|
||||
@@ -347,7 +347,7 @@ function Tabs() //{{{
|
||||
bang: true,
|
||||
count: true,
|
||||
completer: function (context) completion.buffer(context),
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
// TODO: this should open in a new tab positioned directly after the current one, not at the end
|
||||
@@ -362,7 +362,7 @@ function Tabs() //{{{
|
||||
{
|
||||
argCount: "+",
|
||||
completer: function (context) completion.ex(context.filter),
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
commands.add(["tabl[ast]", "bl[ast]"],
|
||||
@@ -477,7 +477,7 @@ function Tabs() //{{{
|
||||
bang: true,
|
||||
count: true,
|
||||
completer: function (context) completion.buffer(context),
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
commands.add(["buffers", "files", "ls", "tabs"],
|
||||
@@ -485,7 +485,7 @@ function Tabs() //{{{
|
||||
function (args) { tabs.list(args.literalArg); },
|
||||
{
|
||||
argCount: "?",
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
commands.add(["quita[ll]", "qa[ll]"],
|
||||
@@ -550,7 +550,7 @@ function Tabs() //{{{
|
||||
{
|
||||
bang: true,
|
||||
completer: function (context) completion.url(context),
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
commands.add(["tabde[tach]"],
|
||||
@@ -635,7 +635,7 @@ function Tabs() //{{{
|
||||
return [0, completions];
|
||||
},
|
||||
count: true,
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
commands.add(["undoa[ll]"],
|
||||
|
||||
@@ -616,7 +616,7 @@ function CommandLine() //{{{
|
||||
},
|
||||
{
|
||||
completer: function (context) completion.javascript(context),
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1439,7 +1439,7 @@ function ItemList(id) //{{{
|
||||
{
|
||||
do
|
||||
var next = nodes[++i];
|
||||
while ((!next || next.parentNode != items) && i < nodes.length);
|
||||
while ((!next || next.parentNode != items) && i < end)
|
||||
items.insertBefore(row, next);
|
||||
}
|
||||
else if (!display && row.parentNode == items)
|
||||
|
||||
@@ -289,7 +289,7 @@ const config = { //{{{
|
||||
{
|
||||
bang: true,
|
||||
completer: function (context) completion.url(context),
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
commands.add(["redr[aw]"],
|
||||
@@ -342,7 +342,7 @@ const config = { //{{{
|
||||
{
|
||||
argCount: "+",
|
||||
completer: function (context) completion.sidebar(context),
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
commands.add(["winc[lose]", "wc[lose]"],
|
||||
@@ -363,7 +363,7 @@ const config = { //{{{
|
||||
},
|
||||
{
|
||||
completer: function (context) completion.url(context),
|
||||
literal: true
|
||||
literal: 0
|
||||
});
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
|
||||
Reference in New Issue
Block a user