diff --git a/content/commands.js b/content/commands.js index 24032d62..40d8380d 100644 --- a/content/commands.js +++ b/content/commands.js @@ -552,12 +552,15 @@ function Commands() //{{{ args.quote = complQuote[quote] || complQuote[""]; } let type = argTypes[opt[1]]; - if (type) + if (type && (!complete || arg != null)) { + liberator.dump("arg: " + arg); arg = type.parse(arg); - if (arg == null || arg == NaN) + liberator.dump("arg: " + arg); + if (arg == null || (typeof arg == "number" && isNaN(arg))) { - echoerr("Invalid argument for " + type.description + "option: " + optname); + liberator.dump("arg: " + arg); + echoerr("Invalid argument for " + type.description + " option: " + optname); if (complete) complete.highlight(args.completeStart, count - 1, "SPELLCHECK"); else @@ -580,6 +583,8 @@ function Commands() //{{{ args[opt[0][0]] = arg; // always use the first name of the option i += optname.length + count; + if (i == str.length) + break outer; continue outer; } // if it is invalid, just fall through and try the next argument diff --git a/content/completion.js b/content/completion.js index 965d416f..a0f2aa35 100644 --- a/content/completion.js +++ b/content/completion.js @@ -51,6 +51,7 @@ function CompletionContext(editor, name, offset) self.contexts[name] = this; self.filters = parent.filters.slice(); self.incomplete = false; + self.message = null; self.parent = parent; self.offset = parent.offset + (offset || 0); self.keys = util.cloneObject(parent.keys); @@ -200,6 +201,9 @@ CompletionContext.prototype = { this.process = format.process || this.process; }, + get message() this._message || (this.incomplete ? "Waiting..." : null), + set message(val) this._message = val, + get regenerate() this._generate && (!this.completions || !this.itemCache[this.key] || this.cache.offset != this.offset), set regenerate(val) { if (val) delete this.itemCache[this.key] }, @@ -1343,11 +1347,11 @@ function Completion() //{{{ context.filterFunc = null; context.compare = null; let timer = new util.Timer(50, 100, function (result) { + context.incomplete = result.searchResult >= result.RESULT_NOMATCH_ONGOING; context.completions = [ [result.getValueAt(i), result.getCommentAt(i), result.getImageAt(i)] for (i in util.range(0, result.matchCount)) ]; - context.incomplete = result.searchResult >= result.RESULT_NOMATCH_ONGOING; }); completionService.stopSearch(); completionService.startSearch(context.filter, "", context.result, { diff --git a/content/liberator.js b/content/liberator.js index ec8a3792..fb0f8359 100644 --- a/content/liberator.js +++ b/content/liberator.js @@ -356,7 +356,7 @@ const liberator = (function () //{{{ commands.add(["loadplugins", "lpl"], "Load all plugins immediately", function () { liberator.loadPlugins(); }, - { argCount: "0" ); + { argCount: "0" }); commands.add(["norm[al]"], "Execute Normal mode commands", diff --git a/content/options.js b/content/options.js index 8e772000..860a7c50 100644 --- a/content/options.js +++ b/content/options.js @@ -699,7 +699,10 @@ function Options() //{{{ context.advance(context.filter.indexOf("=") + 1); if (!option) + { + context.message = "No such option: " + opt.name; context.highlight(0, name.length, "SPELLCHECK"); + } if (opt.get || opt.reset || !option || prefix) return; diff --git a/content/ui.js b/content/ui.js index 7006dcec..d151ac77 100644 --- a/content/ui.js +++ b/content/ui.js @@ -1417,6 +1417,8 @@ function ItemList(id) //{{{ nodes.message.style.display = "none"; if (context.message) { + nodes.up.style.display = "none"; + nodes.down.style.display = "none"; nodes.message.textContent = context.message; nodes.message.style.display = "block"; }