From 20c6aca8673c06715062e6e967c1622aca96c43d Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sun, 30 Nov 2008 12:35:37 +0000 Subject: [PATCH] Anchor option completion matches --- content/completion.js | 3 ++- content/options.js | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/content/completion.js b/content/completion.js index ced5f0cd..d31adbd9 100644 --- a/content/completion.js +++ b/content/completion.js @@ -309,7 +309,7 @@ CompletionContext.prototype = { get substrings() { let items = this.items; - if (items.length == 0) + if (items.length == 0 || !this.hasItems) return []; if (this._substrings) return this._substrings; @@ -1395,6 +1395,7 @@ function Completion() //{{{ option: function option(context, scope) { context.title = ["Option"]; + context.anchored = true; context.keys = { text: "names", description: "description" }; context.completions = options; if (scope) diff --git a/content/options.js b/content/options.js index be173f52..e0c60208 100644 --- a/content/options.js +++ b/content/options.js @@ -683,8 +683,6 @@ function Options() //{{{ let opt = options.parseOpt(filter, modifiers); let prefix = opt.prefix; - if (prefix) - context.advance(prefix.length); if (context.filter.indexOf("=") == -1) { @@ -695,6 +693,9 @@ function Options() //{{{ else if (prefix == "no") return; + if (prefix) + context.advance(prefix.length); + let option = opt.option; context.advance(context.filter.indexOf("=") + 1);