[PATCH] SearchField: trim all whitespace from search text
authorNate Graham <nate@kde.org>
Fri, 13 Jun 2025 16:31:41 +0000 (10:31 -0600)
committerAurélien COUDERC <coucouf@debian.org>
Mon, 14 Jul 2025 21:44:48 +0000 (23:44 +0200)
We already trim newlines, but let's go whole-hog here and do all
whitespace, since none of it serves any purpose.

BUG: 505538
FIXED-IN: 6.4.1

(cherry picked from commit d51f99e2b790daf042294f4080b4405c5e128841)

Co-authored-by: Nate Graham <nate@kde.org>
Gbp-Pq: Name upstream_ac955439_SearchField-trim-all-whitespace-from-search-text.patch

discover/qml/SearchField.qml

index 9b19e55ad10331cecc369aa879ad570425e8182a..d64cabf45b13699e9087e19100ccca985d1e06d9 100644 (file)
@@ -26,7 +26,7 @@ Kirigami.SearchField {
     placeholderText: (!enabled || !page || page.hasOwnProperty("isHome") || window.leftPage.name.length === 0) ? i18n("Search…") : i18n("Search in '%1'…", window.leftPage.name)
 
     onAccepted: {
-        text = text.replace(/\n/g, ' ');
+        text = text.trim();
         currentSearchText = text;
     }