From d8edbcbc55cf7658af025212b7f01acd293d7884 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Wed, 6 May 2020 19:06:14 +0200 Subject: [PATCH] Avoid having to type CR twice to search in some cases Happened for multiword searches on the second and further term because the popup ate the CR but did not fire as there was no active match. --- src/qtgui/ssearch_w.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/qtgui/ssearch_w.cpp b/src/qtgui/ssearch_w.cpp index dd044ec3..179c5fa3 100644 --- a/src/qtgui/ssearch_w.cpp +++ b/src/qtgui/ssearch_w.cpp @@ -250,7 +250,8 @@ void SSearch::onCompleterShown() // This is to avoid that if the user types Backspace or Del while we // have inserted / selected the current completion, the lineedit text // goes back to what it was, the completion fires, and it looks like -// nothing was typed. So we disable the completion if a +// nothing was typed. Disable the completionn after Del or Backspace +// is typed. bool SSearch::eventFilter(QObject *target, QEvent *event) { Q_UNUSED(target); @@ -419,7 +420,9 @@ void SSearch::searchTypeChanged(int typ) void SSearch::startSimpleSearch() { - if (queryText->completer() && queryText->completer()->popup()->isVisible()) { + // Avoid a double search if we are fired on CR and the completer is active + if (queryText->completer() && queryText->completer()->popup()->isVisible() + && !queryText->completer()->currentCompletion().isEmpty()) { return; } string u8 = qs2u8s(queryText->text());