1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-04-18 02:53:32 +02: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.compare = CompletionContext.Sort.unsorted;
ctxt.filterFunc = null; ctxt.filterFunc = null;
if (ctxt.waitingForTab)
return;
let words = ctxt.filter.toLowerCase().split(/\s+/g); let words = ctxt.filter.toLowerCase().split(/\s+/g);
ctxt.completions = ctxt.completions.filter(function (i) words.every(function (w) i.toLowerCase().indexOf(w) >= 0)); 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._cache.offset = this.offset;
this.lastActivated = this.top.runCount; this.lastActivated = this.top.runCount;
} }
if (!this.itemCache[this.key]) { if (!this.itemCache[this.key] && !this.waitingForTab) {
try { try {
let res = this._generate(); let res = this._generate();
if (res != null) if (res != null)
@@ -1017,7 +1017,6 @@ var Completion = Module("completion", {
context.hasItems = true; context.hasItems = true;
context.completions = context.completions.filter(function ({ url, title }) context.completions = context.completions.filter(function ({ url, title })
words.every(function (w) (url + " " + title).toLowerCase().indexOf(w) >= 0)) words.every(function (w) (url + " " + title).toLowerCase().indexOf(w) >= 0))
context.incomplete = true;
context.format = this.modules.bookmarks.format; context.format = this.modules.bookmarks.format;
context.keys.extra = function (item) { context.keys.extra = function (item) {
@@ -1036,6 +1035,9 @@ var Completion = Module("completion", {
running[provider] = false; running[provider] = false;
}; };
if (!context.waitingForTab) {
context.incomplete = true;
service.startSearch(context.filter, "", context.result, { service.startSearch(context.filter, "", context.result, {
onSearchResult: util.wrapCallback(function onSearchResult(search, result) { onSearchResult: util.wrapCallback(function onSearchResult(search, result) {
if (result.searchResult <= result.RESULT_SUCCESS) if (result.searchResult <= result.RESULT_SUCCESS)
@@ -1050,6 +1052,7 @@ var Completion = Module("completion", {
get onUpdateSearchResult() this.onSearchResult get onUpdateSearchResult() this.onSearchResult
}); });
running[provider] = true; running[provider] = true;
}
}), }),
urls: function (context, tags) { urls: function (context, tags) {