diff --git a/content/addressbook.js b/content/addressbook.js index c653f554..7ebd94fb 100644 --- a/content/addressbook.js +++ b/content/addressbook.js @@ -115,7 +115,7 @@ function Addressbook() //{{{ "Add an address book entry", function (args) { - var mailAddr = args.arguments[0]; // TODO: support more than one email address + var mailAddr = args[0]; // TODO: support more than one email address var firstName = args["-firstname"] || null; var lastName = args["-lastname"] || null; var displayName = args["-name"] || null; diff --git a/content/bookmarks.js b/content/bookmarks.js index 9a811b51..8d993a51 100644 --- a/content/bookmarks.js +++ b/content/bookmarks.js @@ -291,8 +291,8 @@ function Bookmarks() //{{{ "Add a bookmark", function (args, special) { - var url = args.arguments.length == 0 ? buffer.URL : args.arguments[0]; - var title = args["-title"] || (args.arguments.length == 0 ? buffer.title : null); + var url = args.length == 0 ? buffer.URL : args[0]; + var title = args["-title"] || (args.length == 0 ? buffer.title : null); var keyword = args["-keyword"] || null; var tags = args["-tags"] || []; @@ -316,7 +316,7 @@ function Bookmarks() //{{{ "List or open multiple bookmarks", function (args, special) { - bookmarks.list(args.arguments.join(" "), args["-tags"] || [], special); + bookmarks.list(args.join(" "), args["-tags"] || [], special); }, { bang: true, diff --git a/content/buffer.js b/content/buffer.js index 9a5eb95c..ce9ed8f7 100644 --- a/content/buffer.js +++ b/content/buffer.js @@ -532,7 +532,7 @@ function Buffer() //{{{ { let doc = window.content.document; let chosenData = null; - let filename = args.arguments[0]; + let filename = args[0]; if (filename) { @@ -577,7 +577,7 @@ function Buffer() //{{{ commands.add(["vie[wsource]"], "View source code of current document", - function (args, special) { buffer.viewSource(args.arguments[0], special); }, + function (args, special) { buffer.viewSource(args[0], special); }, { argCount: "?", bang: true, @@ -1523,7 +1523,7 @@ function Marks() //{{{ "Mark current location within the web page", function (args) { - var mark = args.arguments[0]; + var mark = args[0]; if (mark.length > 1) { liberator.echoerr("E488: Trailing characters"); diff --git a/content/commands.js b/content/commands.js index 96249130..8028db1a 100644 --- a/content/commands.js +++ b/content/commands.js @@ -186,7 +186,7 @@ function Commands() //{{{ let re = RegExp("[" + list + "]", "g"); return function (str) q + String.replace(str, re, function ($0, $1) $1 in quoteMap ? quoteMap[$1] : "\\" + $1) + q; } - const _quoteArg = { // FIXME + const complQuote = { // FIXME '"': ['"', quote("", '\n\t"\\\\'), '"'], "'": ["'", quote("", "\\\\'"), "'"], "": ["", quote("", "\\\\ "), ""] @@ -286,7 +286,7 @@ function Commands() //{{{ if (val != null) res.push(quote(val)); } - for (let [,arg] in Iterator(args.arguments || [])) + for (let [,arg] in Iterator(args || [])) res.push(quote(arg)); let str = args.literalArg; @@ -452,8 +452,7 @@ function Commands() //{{{ if (!argCount) argCount = "*"; - var args = {}; // parsed options - args.arguments = []; // remaining arguments + var args = []; // parsed options args.string = str; // for access to the unparsed string args.literalArg = ""; @@ -479,7 +478,7 @@ function Commands() //{{{ args.completeOpt = null; args.completeFilter = null; args.completeStart = i; - args.quote = _quoteArg[""]; + args.quote = complQuote[""]; } if (complete) { @@ -554,7 +553,7 @@ function Commands() //{{{ args.completeStart += optname.length + 1; args.completeOpt = opt; args.completeFilter = arg; - args.quote = _quoteArg[quote] || _quoteArg[""]; + args.quote = complQuote[quote] || complQuote[""]; } let type = argTypes[opt[1]]; if (type) @@ -599,16 +598,16 @@ function Commands() //{{{ if (complete) { - if (argCount == "0" || args.arguments.length > 0 && (argCount == "1" || argCount == "?")) + if (argCount == "0" || args.length > 0 && (argCount == "1" || argCount == "?")) complete.highlight(i, sub.length, "SPELLCHECK") } - if (literal && args.arguments.length == literalIndex) + if (literal && args.length == literalIndex) { args.literalArg = sub; - args.arguments.push(sub); + args.push(sub); if (complete) - args.completeArg = args.arguments.length - 1; + args.completeArg = args.length - 1; break; } @@ -616,7 +615,7 @@ function Commands() //{{{ var [count, arg, quote] = getNextArg(sub); if (complete) { - args.quote = _quoteArg[quote] || _quoteArg[""]; + args.quote = complQuote[quote] || complQuote[""]; args.completeFilter = arg || ""; } else if (count == -1) @@ -631,9 +630,9 @@ function Commands() //{{{ } if (arg != null) - args.arguments.push(arg); + args.push(arg); if (complete) - args.completeArg = args.arguments.length - 1; + args.completeArg = args.length - 1; if (count <= 0) break; @@ -662,15 +661,15 @@ function Commands() //{{{ } // check for correct number of arguments - if (!complete && (args.arguments.length == 0 && /^[1+]$/.test(argCount) || + if (!complete && (args.length == 0 && /^[1+]$/.test(argCount) || // TODO: what is this for? -- djk literal && argCount == "+" && /^\s*$/.test(args.literalArg))) { liberator.echoerr("E471: Argument required"); return null; } - else if (args.arguments.length == 1 && (argCount == "0") || - args.arguments.length > 1 && /^[01?]$/.test(argCount)) + else if (args.length == 1 && (argCount == "0") || + args.length > 1 && /^[01?]$/.test(argCount)) { if (!complete) liberator.echoerr("E488: Trailing characters"); @@ -776,7 +775,7 @@ function Commands() //{{{ "List and define commands", function (args, special) { - let cmd = args.arguments[0]; + let cmd = args[0]; if (cmd != null && /\W/.test(cmd)) { @@ -899,7 +898,7 @@ function Commands() //{{{ "Delete the specified user-defined command", function (args) { - let name = args.arguments[0]; + let name = args[0]; if (commands.get(name)) commands.removeUserCommand(name); diff --git a/content/editor.js b/content/editor.js index 26dc5274..8e6071cd 100644 --- a/content/editor.js +++ b/content/editor.js @@ -166,7 +166,7 @@ function Editor() //{{{ "Abbreviate a key sequence" + modeDescription, function (args) { - let [lhs, rhs] = args.arguments; + let [lhs, rhs] = args; if (rhs) editor.addAbbreviation(mode, lhs, rhs); else diff --git a/content/events.js b/content/events.js index 7d1c7b8e..8186db93 100644 --- a/content/events.js +++ b/content/events.js @@ -72,7 +72,7 @@ function AutoCommands() //{{{ "Execute commands automatically on events", function (args, special) { - let [event, regex, cmd] = args.arguments; + let [event, regex, cmd] = args; let events = null; if (event) { @@ -101,7 +101,7 @@ function AutoCommands() //{{{ if (special) { // TODO: "*" only appears to work in Vim when there is a {group} specified - if (args.arguments[0] != "*" || regex) + if (args[0] != "*" || regex) autocommands.remove(event, regex); // remove all } else @@ -725,7 +725,7 @@ function Events() //{{{ commands.add(["macros"], "List all macros", - function (args) { completion.listCompleter("macro", args.arguments[0]) }, + function (args) { completion.listCompleter("macro", args[0]) }, { argCount: "1", completer: function (context) completion.macro(context), @@ -733,7 +733,7 @@ function Events() //{{{ commands.add(["pl[ay]"], "Replay a recorded macro", - function (args) { events.playMacro(args.arguments[0]); }, + function (args) { events.playMacro(args[0]); }, { argCount: "1", completer: function (context) completion.macro(context) diff --git a/content/io.js b/content/io.js index d582a607..22304c73 100644 --- a/content/io.js +++ b/content/io.js @@ -244,7 +244,7 @@ function IO() //{{{ function (args, special) { // TODO: "E172: Only one file name allowed" - let filename = args.arguments[0] || "~/" + (WINDOWS ? "_" : ".") + EXTENSION_NAME + "rc"; + let filename = args[0] || "~/" + (WINDOWS ? "_" : ".") + EXTENSION_NAME + "rc"; let file = io.getFile(filename); if (file.exists() && !special) @@ -288,7 +288,7 @@ function IO() //{{{ commands.add(["runt[ime]"], "Source the specified file from each directory in 'runtimepath'", - function (args, special) { io.sourceFromRuntimePath(args.arguments, special); }, + function (args, special) { io.sourceFromRuntimePath(args, special); }, { argCount: "+", bang: true @@ -311,7 +311,7 @@ function IO() //{{{ function (args, special) { // FIXME: "E172: Only one file name allowed" - io.source(args.arguments[0], special); + io.source(args[0], special); }, { argCount: "1", diff --git a/content/liberator.js b/content/liberator.js index 8d1b57e7..6871b14d 100644 --- a/content/liberator.js +++ b/content/liberator.js @@ -183,7 +183,7 @@ const liberator = (function () //{{{ "Open a " + config.name + " dialog", function (args) { - args = args.arguments[0]; + args = args[0]; try { diff --git a/content/mail.js b/content/mail.js index 3be0fbc5..7a71a6a4 100644 --- a/content/mail.js +++ b/content/mail.js @@ -685,14 +685,14 @@ function Mail() //{{{ function (args) { var mailargs = {}; - mailargs.to = args.arguments.join(", "); + mailargs.to = args.join(", "); mailargs.subject = args["-subject"]; mailargs.bcc = args["-bcc"]; mailargs.cc = args["-cc"]; mailargs.body = args["-text"]; mailargs.attachments = args["-attachment"] || []; - var addresses = args.arguments; + var addresses = args; if (mailargs.bcc) addresses = addresses.concat(mailargs.bcc); if (mailargs.cc) diff --git a/content/mappings.js b/content/mappings.js index e4615b8d..3b848828 100644 --- a/content/mappings.js +++ b/content/mappings.js @@ -151,14 +151,14 @@ function Mappings() //{{{ // 2 args -> map arg1 to arg* function map(args, mode, noremap) { - if (!args.arguments.length) + if (!args.length) { mappings.list(mode); return; } // ?:\s+ <- don't remember; (...)? optional = rhs - let [lhs, rhs] = args.arguments; + let [lhs, rhs] = args; if (!rhs) // list the mapping { @@ -224,7 +224,7 @@ function Mappings() //{{{ "Remove a mapping" + modeDescription, function (args) { - args = args.arguments[0]; + args = args[0]; let found = false; for (let [,mode] in Iterator(modes)) diff --git a/content/options.js b/content/options.js index fd15429e..3f5302cb 100644 --- a/content/options.js +++ b/content/options.js @@ -786,9 +786,9 @@ function Options() //{{{ //var length = names.length; //for (let i = 0, name = names[i]; i < length; name = names[++i]) - for (let i = 0; i < args.arguments.length; i++) + for (let i = 0; i < args.length; i++) { - var name = args.arguments[i]; + var name = args[i]; var reference = liberator.variableReference(name); if (!reference[0]) { diff --git a/content/style.js b/content/style.js index a0145043..5c6c5bb1 100644 --- a/content/style.js +++ b/content/style.js @@ -385,7 +385,7 @@ liberator.registerObserver("load_commands", function () "Load a color scheme", function (args) { - let scheme = args.arguments[0]; + let scheme = args[0]; if (io.sourceFromRuntimePath(["colors/" + scheme + ".vimp"])) autocommands.trigger("ColorScheme", { name: scheme }); @@ -401,7 +401,7 @@ liberator.registerObserver("load_commands", function () "Add or list user styles", function (args, special) { - let [filter, css] = args.arguments; + let [filter, css] = args; let name = args["-name"]; if (!css) @@ -471,7 +471,7 @@ liberator.registerObserver("load_commands", function () commands.add(["dels[tyle]"], "Remove a user stylesheet", function (args) { - styles.removeSheet(args["-name"], args.arguments[0], args.literalArg, args["-index"], false); + styles.removeSheet(args["-name"], args[0], args.literalArg, args["-index"], false); }, { argCount: 2, @@ -494,7 +494,7 @@ liberator.registerObserver("load_commands", function () height: 1em !important; min-height: 1em !important; max-height: 1em !important; overflow: hidden !important; ]]>; - let [key, css] = args.arguments; + let [key, css] = args; if (!css && !(key && special)) { let str = template.tabular(["Key", "Sample", "CSS"], @@ -521,7 +521,7 @@ liberator.registerObserver("load_commands", function () context.completions = [[v.class, ""] for (v in highlight)]; else if (args.completeArg == 1) { - let hl = highlight.get(args.arguments[0]); + let hl = highlight.get(args[0]); if (hl) context.completions = [[hl.value, "Current Value"], [hl.default || "", "Default Value"]]; }