]> cloud.milkyroute.net Git - dolphin.git/commitdiff
[search] Do not update text input when it has focus
authorIsmael Asensio <isma.af@gmail.com>
Sat, 4 Jul 2020 13:42:55 +0000 (15:42 +0200)
committerElvis Angelaccio <elvis.angelaccio@kde.org>
Sun, 5 Jul 2020 17:14:19 +0000 (17:14 +0000)
When the user is entering a search term, a delayed search will be
emmited after a few seconds. This means updating the search URL, which
in turn gets parsed and reflected back on the search input.

To avoid interrupting the user input flow and unexpectedly move the
cursor to the end, let's update the input search box only when it
doesn't have the focus.

It's still updated on other interactions such as changing the search
options or clicking a saved search on the places panel.

BUG: 423328
FIXED-IN: 20.08

src/search/dolphinsearchbox.cpp

index 239280280253f01e490fc98e7b6c87cbd0518046..20a527ff4672d6dd204eca7ab0bd3254079f65e0 100644 (file)
@@ -520,7 +520,10 @@ void DolphinSearchBox::updateFromQuery(const DolphinQuery& query)
         setSearchPath(QUrl::fromLocalFile(QDir::homePath()));
     }
 
-    setText(query.text());
+    // If the input box has focus, do not update to avoid messing with user typing
+    if (!m_searchInput->hasFocus()) {
+        setText(query.text());
+    }
 
     if (query.hasContentSearch()) {
         m_contentButton->setChecked(true);