diff --git a/content/commands.js b/content/commands.js index 5839d8cd..90c6a09c 100644 --- a/content/commands.js +++ b/content/commands.js @@ -491,6 +491,14 @@ function Commands() //{{{ args.completeArg = 0; } + function echoerr(error) + { + if (complete) + complete.message = error; + else + liberator.echoerr(error); + } + outer: while (i < str.length || complete) { @@ -565,13 +573,11 @@ function Commands() //{{{ arg = type.parse(arg); if (arg == null || arg == NaN) { + echoerr("Invalid argument for " + type.description + "option: " + optname); if (complete) complete.highlight(args.completeStart, count - 1, "SPELLCHECK"); else - { - liberator.echoerr("Invalid argument for " + type.description + "option: " + optname); return null; - } } } @@ -580,13 +586,11 @@ function Commands() //{{{ { if (opt[2].call(this, arg) == false) { + echoerr("Invalid argument for option: " + optname); if (complete) complete.highlight(args.completeStart, count - 1, "SPELLCHECK"); else - { - liberator.echoerr("Invalid argument for option: " + optname); return null; - } } } @@ -678,8 +682,7 @@ function Commands() //{{{ else if (args.length == 1 && (argCount == "0") || args.length > 1 && /^[01?]$/.test(argCount)) { - if (!complete) - liberator.echoerr("E488: Trailing characters"); + echoerr("E488: Trailing characters"); return null; } diff --git a/content/liberator.js b/content/liberator.js index 1e3d9ccd..ec8a3792 100644 --- a/content/liberator.js +++ b/content/liberator.js @@ -355,7 +355,8 @@ const liberator = (function () //{{{ commands.add(["loadplugins", "lpl"], "Load all plugins immediately", - function () { liberator.loadPlugins(); }); + function () { liberator.loadPlugins(); }, + { argCount: "0" ); commands.add(["norm[al]"], "Execute Normal mode commands",