diff --git a/chrome/content/zotero/elements/itemBox.js b/chrome/content/zotero/elements/itemBox.js index fe4d09d506..8578e543c8 100644 --- a/chrome/content/zotero/elements/itemBox.js +++ b/chrome/content/zotero/elements/itemBox.js @@ -1993,8 +1993,8 @@ var id = false; for (let i = 0; i < controller.matchCount; i++) { - if (controller.getCommentAt(i) == textbox.value) { - id = controller.getLabelAt(i); + if (controller.getValueAt(i) == textbox.value) { + id = controller.getCommentAt(i); break; } } diff --git a/chrome/content/zotero/zotero-autocomplete.js b/chrome/content/zotero/zotero-autocomplete.js index 5b569dfdc3..d556fa57c9 100644 --- a/chrome/content/zotero/zotero-autocomplete.js +++ b/chrome/content/zotero/zotero-autocomplete.js @@ -286,7 +286,7 @@ ZoteroAutoComplete.prototype.startSearch = Zotero.Promise.coroutine(function* (s ZoteroAutoComplete.prototype.updateResult = function (value, id) { Zotero.debug(`Appending autocomplete value '${value}'` + (id ? " (" + id + ")" : '')); // Add to nsIAutoCompleteResult - this._result.appendMatch(value, value, null, null, null, id); + this._result.appendMatch(value, id, null, null, null, value); // Add to our own list this._results.push(value); // Only update the UI every 10 records @@ -311,7 +311,7 @@ ZoteroAutoComplete.prototype.updateResults = function (values, ids, ongoing, res if (!this._results.includes(value)) { let id = ids[i] || null; Zotero.debug("Adding autocomplete value '" + value + "'" + (id ? " (" + id + ")" : "")); - this._result.appendMatch(value, value, null, null, null, id); + this._result.appendMatch(value, id, null, null, null, value); this._results.push(value); } else {