1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 08:08:00 +01:00

Partially fix completions with mismatched start offsets

This commit is contained in:
Kris Maglione
2008-11-24 11:12:06 +00:00
parent 862a6cae7c
commit ced94146f8
3 changed files with 12 additions and 9 deletions

View File

@@ -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);