From ba15c2b53e19b98a2f14f0b58c92da7efeda9417 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 24 Oct 2019 04:45:45 -0400 Subject: [PATCH] Fx60: Mostly fix autocomplete There's still a bug when autocompleting tags where the value remains in the new text field. --- chrome/content/zotero/bindings/itembox.xml | 14 +++--- chrome/skin/default/zotero/overlay.css | 18 +++++++ components/zotero-autocomplete.js | 58 +++++++++++----------- 3 files changed, 53 insertions(+), 37 deletions(-) diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml index 9c08a8b8a6..4c2efd1102 100644 --- a/chrome/content/zotero/bindings/itembox.xml +++ b/chrome/content/zotero/bindings/itembox.xml @@ -1615,25 +1615,23 @@ x.val), - Object.values(results).map(x => x.comment), + Object.values(results).map(x => x.id), false ); } @@ -251,36 +251,36 @@ ZoteroAutoComplete.prototype.startSearch = Zotero.Promise.coroutine(function* (s }); -ZoteroAutoComplete.prototype.updateResult = function (result, comment) { - Zotero.debug("Appending autocomplete value '" + result + "'" + (comment ? " (" + comment + ")" : "")); +ZoteroAutoComplete.prototype.updateResult = function (value, id) { + Zotero.debug(`Appending autocomplete value '${value}'` + (id ? " (" + id + ")" : '')); // Add to nsIAutoCompleteResult - this._result.appendMatch(result, comment ? comment : null); + this._result.appendMatch(value, value, null, null, null, id); // Add to our own list - this._results.push(result); + this._results.push(value); // Only update the UI every 10 records if (this._result.matchCount % 10 == 0) { this._result.setSearchResult(Ci.nsIAutoCompleteResult.RESULT_SUCCESS_ONGOING); - this._listener.onUpdateSearchResult(this, this._result); + this._listener.onSearchResult(this, this._result); } } -ZoteroAutoComplete.prototype.updateResults = function (results, comments, ongoing, resultCode) { - if (!results) { - results = []; +ZoteroAutoComplete.prototype.updateResults = function (values, ids, ongoing, resultCode) { + if (!values) { + values = []; } - if (!comments) { - comments = []; + if (!ids) { + ids = []; } - for (var i=0; i