1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-30 18:25:46 +01:00

Fix some non-working 'autocomplete' uses.

This commit is contained in:
Kris Maglione
2012-05-21 19:15:09 -04:00
parent 3366c208f4
commit 7cba7018fa
2 changed files with 21 additions and 15 deletions

View File

@@ -708,6 +708,9 @@ var Bookmarks = Module("bookmarks", {
ctxt.compare = CompletionContext.Sort.unsorted;
ctxt.filterFunc = null;
if (ctxt.waitingForTab)
return;
let words = ctxt.filter.toLowerCase().split(/\s+/g);
ctxt.completions = ctxt.completions.filter(function (i) words.every(function (w) i.toLowerCase().indexOf(w) >= 0));

View File

@@ -412,7 +412,7 @@ var CompletionContext = Class("CompletionContext", {
this._cache.offset = this.offset;
this.lastActivated = this.top.runCount;
}
if (!this.itemCache[this.key]) {
if (!this.itemCache[this.key] && !this.waitingForTab) {
try {
let res = this._generate();
if (res != null)
@@ -1017,7 +1017,6 @@ var Completion = Module("completion", {
context.hasItems = true;
context.completions = context.completions.filter(function ({ url, title })
words.every(function (w) (url + " " + title).toLowerCase().indexOf(w) >= 0))
context.incomplete = true;
context.format = this.modules.bookmarks.format;
context.keys.extra = function (item) {
@@ -1036,20 +1035,24 @@ var Completion = Module("completion", {
running[provider] = false;
};
service.startSearch(context.filter, "", context.result, {
onSearchResult: util.wrapCallback(function onSearchResult(search, result) {
if (result.searchResult <= result.RESULT_SUCCESS)
running[provider] = null;
if (!context.waitingForTab) {
context.incomplete = true;
context.incomplete = result.searchResult >= result.RESULT_NOMATCH_ONGOING;
context.completions = [
{ url: result.getValueAt(i), title: result.getCommentAt(i), icon: result.getImageAt(i) }
for (i in util.range(0, result.matchCount))
];
}),
get onUpdateSearchResult() this.onSearchResult
});
running[provider] = true;
service.startSearch(context.filter, "", context.result, {
onSearchResult: util.wrapCallback(function onSearchResult(search, result) {
if (result.searchResult <= result.RESULT_SUCCESS)
running[provider] = null;
context.incomplete = result.searchResult >= result.RESULT_NOMATCH_ONGOING;
context.completions = [
{ url: result.getValueAt(i), title: result.getCommentAt(i), icon: result.getImageAt(i) }
for (i in util.range(0, result.matchCount))
];
}),
get onUpdateSearchResult() this.onSearchResult
});
running[provider] = true;
}
}),
urls: function (context, tags) {