diff --git a/content/commands.js b/content/commands.js index 3daf54d8..64483214 100644 --- a/content/commands.js +++ b/content/commands.js @@ -618,17 +618,20 @@ function Commands() //{{{ { let opt = args.completeOpt; let context = complete.fork(opt[0][0], args.completeStart); + context.filter = args.completeFilter; if (typeof opt[3] == "function") var compl = opt[3](context, args); else compl = opt[3] || []; context.title = [opt[0][0]]; - context.completions = completion.filter(compl.map(function ([k, v]) [args.quote(k), v]), args.completeFilter);; + context.quote = args.quote; + context.completions = compl; } complete.advance(args.completeStart); complete.title = ["Options"]; if (completeOpts) complete.completions = completeOpts; + } // check for correct number of arguments diff --git a/content/completion.js b/content/completion.js index 02f65cad..fb34607a 100644 --- a/content/completion.js +++ b/content/completion.js @@ -91,10 +91,10 @@ CompletionContext.prototype = { let self = this; let minStart = Math.min.apply(Math, [context.offset for ([k, context] in Iterator(this.contexts)) if (context.items.length && context.hasItems)]); let items = this.contextList.map(function (context) { - let prefix = self.value.substring(minStart, context.offset); if (!context.hasItems) return []; - return context.items; + let prefix = self.value.substring(minStart, context.offset); + return [{ text: prefix + item.text, item: item.item } for ([i, item] in Iterator(context.items))]; }); return { start: minStart, items: util.Array.flatten(items) } }, @@ -1167,7 +1167,6 @@ function Completion() //{{{ if (compObject != null) { cmdContext.advance(compObject.start); - cmdContext.title = ["Completions"]; cmdContext.filterFunc = function (k) k; cmdContext.completions = compObject.items; } @@ -1333,7 +1332,6 @@ function Completion() //{{{ context.title = ["Shell Command", "Path"]; context.generate = function () { - liberator.dump("generate"); const environmentService = Components.classes["@mozilla.org/process/environment;1"] .getService(Components.interfaces.nsIEnvironment); diff --git a/content/style.js b/content/style.js index 0a4f912d..165371ef 100644 --- a/content/style.js +++ b/content/style.js @@ -488,7 +488,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[0]; + let [key, css] = args.arguments; if (!css && !(key && special)) { let str = template.tabular(["Key", "Sample", "CSS"], @@ -509,9 +509,11 @@ liberator.registerObserver("load_commands", function () argCount: 2, bang: true, // TODO: add this as a standard highlight completion function? - completer: function (context) [0, - completion.filter([[v.class, ""] for (v in highlight)], context.filter) - ], + completer: function (context, args) + { + if (args.completeArg == 0) + context.completions = [[v.class, ""] for (v in highlight)]; + }, hereDoc: true, literal: true, options: [[["-append", "-a"], commands.OPTION_NOARG]],