Only defer the quick search while a quotation mark is unclosed

Searching was deferred whenever the query contained a double quotation
mark, with an items-pane message to press Enter. Quoted phrases are no
longer expensive now that Everything mode uses full-text search, so
defer only while an unclosed quote means the phrase is still being
typed, and search as soon as it's closed. Enter still forces a search
mid-quote.
This commit is contained in:
Dan Stillman 2026-08-07 10:49:26 -04:00
parent 0746c665a9
commit 3f7b3d07c5
3 changed files with 3 additions and 13 deletions

View file

@ -3185,13 +3185,6 @@ var ZoteroPane = new function () {
}
this.handleSearchInput = function (textbox, event) {
if (textbox.searchTextbox.value.indexOf('"') != -1) {
this.setItemsPaneMessage(Zotero.getString('advancedSearchMode'));
}
}
/**
* @return {Promise}
*/
@ -3201,7 +3194,9 @@ var ZoteroPane = new function () {
}
var search = document.getElementById('zotero-tb-search');
var searchVal = search.searchTextbox.value;
if (!runAdvanced && searchVal.indexOf('"') != -1) {
// An unclosed quotation mark means a phrase is still being typed, so
// wait for the closing quote, or an explicit Enter, to search
if (!runAdvanced && (searchVal.match(/"/g) || []).length % 2) {
return;
}
var spinner = document.getElementById('zotero-tb-search-spinner');
@ -3210,9 +3205,6 @@ var ZoteroPane = new function () {
await this.itemsView.setFilter('search', searchVal);
spinner.style.removeProperty("visibility");
spinner.removeAttribute("status");
if (runAdvanced) {
this.clearItemsPaneMessage();
}
};

View file

@ -1342,7 +1342,6 @@
<image id="zotero-tb-search-spinner" class="zotero-spinner-16"/>
<quick-search-textbox id="zotero-tb-search" timeout="250"
onkeydown="ZoteroPane_Local.handleSearchKeypress(this, event)"
oninput="ZoteroPane_Local.handleSearchInput(this, event)"
oncommand="ZoteroPane_Local.search()"/>
<!-- Stacked mode only: Toggle Item Pane button -->

View file

@ -773,7 +773,6 @@ quickSearch.mode.titleCreatorYear = Title, Creator, Year
quickSearch.mode.fieldsAndTags = All Fields & Tags
quickSearch.mode.everything = Everything
advancedSearchMode = Advanced search mode — press Enter to search.
searchInProgress = Search in progress — please wait.
searchOperator.is = is