[LyX/master] Prevent infinite loop with instant search on Mac (#12161)
Juergen Spitzmueller
spitz at lyx.org
Sun Feb 28 16:31:33 UTC 2021
commit 939dc4076fe577a40dea99ec668c92c7a6a1d711
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Sun Feb 28 17:34:42 2021 +0100
Prevent infinite loop with instant search on Mac (#12161)
The search dialog was repeatedly feeded with the same string, and a
new search was triggered.
---
src/frontends/qt/GuiSearch.cpp | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/frontends/qt/GuiSearch.cpp b/src/frontends/qt/GuiSearch.cpp
index 169c7aa..54e4ea6 100644
--- a/src/frontends/qt/GuiSearch.cpp
+++ b/src/frontends/qt/GuiSearch.cpp
@@ -417,7 +417,9 @@ void GuiSearchWidget::showEvent(QShowEvent * e)
void GuiSearchWidget::findBufferChanged()
{
docstring search = theClipboard().getFindBuffer();
- if (!search.empty()) {
+ // update from find buffer, but only if the strings differs (else we
+ // might end up in loops with search as you type)
+ if (!search.empty() && toqstr(search) != findCO->lineEdit()->text()) {
LYXERR(Debug::CLIPBOARD, "from findbuffer: " << search);
findCO->lineEdit()->selectAll();
findCO->lineEdit()->insert(toqstr(search));
More information about the lyx-cvs
mailing list