diff --git a/content/bookmarks.js b/content/bookmarks.js
index 08bca367..1c6e4991 100644
--- a/content/bookmarks.js
+++ b/content/bookmarks.js
@@ -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)
});
diff --git a/content/buffer.js b/content/buffer.js
index 8263bbaa..1dac2c43 100644
--- a/content/buffer.js
+++ b/content/buffer.js
@@ -521,7 +521,7 @@ function Buffer() //{{{
},
{
completer: function (context) completion.alternateStylesheet(context),
- literal: true
+ literal: 0
});
commands.add(["re[load]"],
diff --git a/content/commands.js b/content/commands.js
index 40d8380d..d61a8d52 100644
--- a/content/commands.js
+++ b/content/commands.js
@@ -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,
diff --git a/content/completion.js b/content/completion.js
index a0f2aa35..bda63896 100644
--- a/content/completion.js
+++ b/content/completion.js
@@ -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 }) <>
- {item.indicator}
- { process.call(this, { item: item, text: text }) }
+ context.process = [function (item)
+ <>
+ {item.item.indicator}
+ { 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
};
});
},
diff --git a/content/editor.js b/content/editor.js
index d911ee25..af52c089 100644
--- a/content/editor.js
+++ b/content/editor.js
@@ -173,8 +173,7 @@ function Editor() //{{{
editor.listAbbreviations(mode, lhs || "");
},
{
- argCount: 2,
- literal: true,
+ literal: 1,
serial: function () [
{
command: this.name,
diff --git a/content/events.js b/content/events.js
index e27682eb..958bfbc2 100644
--- a/content/events.js
+++ b/content/events.js
@@ -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"],
diff --git a/content/io.js b/content/io.js
index fd80444b..2691aaa4 100644
--- a/content/io.js
+++ b/content/io.js
@@ -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
});
/////////////////////////////////////////////////////////////////////////////}}}
diff --git a/content/liberator.js b/content/liberator.js
index fb0f8359..f97d51fe 100644
--- a/content/liberator.js
+++ b/content/liberator.js
@@ -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]"],
diff --git a/content/mappings.js b/content/mappings.js
index 1811cd69..5f9aeaaf 100644
--- a/content/mappings.js
+++ b/content/mappings.js
@@ -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: [
[["", ""], commands.OPTION_NOARG]
],
- literal: true,
+ literal: 1,
serial: function () {
let noremap = this.name.indexOf("noremap") > -1;
return [
diff --git a/content/options.js b/content/options.js
index 860a7c50..eb335e3f 100644
--- a/content/options.js
+++ b/content/options.js
@@ -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,
diff --git a/content/style.js b/content/style.js
index 7c23d5f5..6f87a974 100644
--- a/content/style.js
+++ b/content/style.js
@@ -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 () [
{
diff --git a/content/tabs.js b/content/tabs.js
index 7484a5e4..d39b9268 100644
--- a/content/tabs.js
+++ b/content/tabs.js
@@ -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]"],
diff --git a/content/ui.js b/content/ui.js
index d151ac77..367a3c11 100644
--- a/content/ui.js
+++ b/content/ui.js
@@ -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)
diff --git a/content/vimperator.js b/content/vimperator.js
index 8cf4aadd..c159b4c0 100644
--- a/content/vimperator.js
+++ b/content/vimperator.js
@@ -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
});
/////////////////////////////////////////////////////////////////////////////}}}