Bug 505538 - Discover should trim whitespace in input when searching
Summary: Discover should trim whitespace in input when searching
Status: RESOLVED FIXED
Alias: None
Product: Discover
Classification: Applications
Component: discover (other bugs)
Version First Reported In: 6.3.5
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2025-06-12 17:33 UTC by Ben Creasy
Modified: 2025-06-16 12:04 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.4.1
Sentry Crash Report:


Attachments
clipboard history (91.67 KB, image/png)
2025-06-12 17:33 UTC, Ben Creasy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Creasy 2025-06-12 17:33:27 UTC
Created attachment 182233 [details]
clipboard history

SUMMARY
I wanted to install https://flathub.org/apps/page.codeberg.JakobDev.jdFlatpakSnapshot - so I copied the title jdFlatpakSnapshot and put it in Discover, but I got no results. After some investigation, I found that when I copied from the header of flathub in Google Chrome it had included a newline character at the end. After removing that newline character jdFlatpakSnapshot was pulled up and I installed it.

I'm using a Thinkpad T480 with tap-to-click and I tapped three times in rapid succession to highlight and then ctrl+c to copy. I found that if I only tap twice, I don't get the newline.

In this case the newline character was invisible, but using visible whitespace characters also creates the issue.

Suggestion is to trim the input, especially if no results are found including the whitespace. For example "Firefox " does not pull up Firefox, only apps with firefox in the description.

STEPS TO REPRODUCE
1. navigate to https://flathub.org/apps/page.codeberg.JakobDev.jdFlatpakSnapshot and triple click on the header app name on a laptop, notice that the copied value in the clipboard history has a newline
2. Paste into Discover

OBSERVED RESULT
No results

EXPECTED RESULT
A result of the app

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: Linux aurora 6.14.5-300.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Fri May  2 14:16:46 UTC 2025 x86_64 GNU/Linux
KDE Plasma Version:  6.3.5
KDE Frameworks Version: 6.14.0
Qt Version: 6.9.0

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2025-06-12 17:55:20 UTC
Seems reasonable.
Comment 2 Bug Janitor Service 2025-06-12 19:19:48 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/discover/-/merge_requests/1114
Comment 3 Nate Graham 2025-06-13 16:31:23 UTC
Git commit d51f99e2b790daf042294f4080b4405c5e128841 by Nate Graham.
Committed on 13/06/2025 at 16:24.
Pushed by ngraham into branch 'master'.

SearchField: trim all whitespace from search text

We already trim newlines, but let's go whole-hog here and do all
whitespace, since none of it serves any purpose.
FIXED-IN: 6.4.1

M  +1    -1    discover/qml/SearchField.qml

https://invent.kde.org/plasma/discover/-/commit/d51f99e2b790daf042294f4080b4405c5e128841
Comment 4 Nate Graham 2025-06-13 16:31:45 UTC
Git commit ac955439ff6434cf2738dd3ffe05c25ff971d180 by Nate Graham.
Committed on 13/06/2025 at 16:31.
Pushed by ngraham into branch 'Plasma/6.4'.

SearchField: trim all whitespace from search text

We already trim newlines, but let's go whole-hog here and do all
whitespace, since none of it serves any purpose.
FIXED-IN: 6.4.1


(cherry picked from commit d51f99e2b790daf042294f4080b4405c5e128841)

Co-authored-by: Nate Graham <nate@kde.org>

M  +1    -1    discover/qml/SearchField.qml

https://invent.kde.org/plasma/discover/-/commit/ac955439ff6434cf2738dd3ffe05c25ff971d180