mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 10:08:00 +01:00
Turn completion sorting back on. Fix completion bug.
This commit is contained in:
@@ -54,7 +54,7 @@ function CompletionContext(editor, name, offset)
|
|||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.offset = parent.offset + (offset || 0);
|
this.offset = parent.offset + (offset || 0);
|
||||||
this.keys = util.cloneObject(this.parent.keys);
|
this.keys = util.cloneObject(this.parent.keys);
|
||||||
["editor", "filterFunc", "keys", "title", "top"].forEach(function (key)
|
["compare", "editor", "filterFunc", "keys", "title", "top"].forEach(function (key)
|
||||||
self[key] = parent[key]);
|
self[key] = parent[key]);
|
||||||
["contextList", "onUpdate", "selectionTypes", "tabPressed", "updateAsync", "value"].forEach(function (key) {
|
["contextList", "onUpdate", "selectionTypes", "tabPressed", "updateAsync", "value"].forEach(function (key) {
|
||||||
self.__defineGetter__(key, function () this.top[key]);
|
self.__defineGetter__(key, function () this.top[key]);
|
||||||
@@ -68,6 +68,7 @@ function CompletionContext(editor, name, offset)
|
|||||||
this._value = editor;
|
this._value = editor;
|
||||||
else
|
else
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
|
this.compare = function (a, b) String.localeCompare(a.text, b.text);
|
||||||
this.filterFunc = completion.filter;
|
this.filterFunc = completion.filter;
|
||||||
this.keys = { text: 0, description: 1, icon: "icon" };
|
this.keys = { text: 0, description: 1, icon: "icon" };
|
||||||
this.offset = offset || 0;
|
this.offset = offset || 0;
|
||||||
@@ -193,6 +194,8 @@ CompletionContext.prototype = {
|
|||||||
completion.getKey = this.getKey; // XXX
|
completion.getKey = this.getKey; // XXX
|
||||||
this.cache.filtered = this.filterFunc(items.map(function (item) ({ text: text(item), item: item })),
|
this.cache.filtered = this.filterFunc(items.map(function (item) ({ text: text(item), item: item })),
|
||||||
this.filter, this.anchored);
|
this.filter, this.anchored);
|
||||||
|
if (options.get("wildoptions").has("sort"))
|
||||||
|
this.cache.filtered.sort(this.compare);
|
||||||
completion.getKey = null;
|
completion.getKey = null;
|
||||||
|
|
||||||
return this.cache.filtered;
|
return this.cache.filtered;
|
||||||
|
|||||||
Reference in New Issue
Block a user