Bug 413709

Summary: krunner searches for the text suggested by auto-completion before actually accepting the suggestion
Product: [Plasma] krunner Reporter: TigerShark <tieskey>
Component: generalAssignee: Alexander Lohnau <alexander.lohnau>
Status: RESOLVED FIXED    
Severity: normal CC: alexander.lohnau, angel.tsankov, fabian, nate, postix
Priority: NOR    
Version: master   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 6.0
Sentry Crash Report:
Attachments: The KLineEdit (here in Dolphin) has the kind of functionality we want!

Description TigerShark 2019-11-01 14:41:07 UTC
SUMMARY
When one types in krunner it will offer to auto-complete what u type, but it will also search for programs/commands/files based on the suggested text and not what one has actually typed so far.
Basically, plz, plz, plz (if it's not a bug but a design decision), stop automatically accepting word completion suggestions. Leave them as suggestions that have to be accepted by pressing tab.

STEPS TO REPRODUCE
1. Have for example the discord app or a discord tab in the browser
2. Open krunner type "dis" and click on whatever item belongs to "discord" several times
3. Open krunner and type "dis", text auto-completion will suggest the word "discord", don't accept it (don't press tab). 

OBSERVED RESULT
Items below will only show results for "discord" instead of "dis"

EXPECTED RESULT
Search results for the actual typed text "dis". 

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Kubuntu 19.10 
(available in About System)
KDE Plasma Version: 5.17.2
KDE Frameworks Version: 5.62.0
Qt Version: 5.12.4

ADDITIONAL INFORMATION
Comment 1 Alexander Lohnau 2020-06-28 05:11:54 UTC
While this is sometimes useful it can be annoying.

The fish shell has a very cool way of handling auto completion.
Comment 2 Bug Janitor Service 2020-06-28 09:49:59 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/122
Comment 3 TigerShark 2020-06-28 15:41:52 UTC
First time I hear about fish shell. Will give it a try.

Didn't understand the related PR. Setting that history to 0 would disable the auto completion?
If so, it could function as some kind of workaround I guess.

I might be repeating myself but let me go over the idea again.

I'm in no way against offering auto-completion, just against suggestions being automatically "accepted" and searched for without user confirmation by pressing Tab (or right arrow maybe).


Automatically searching for suggestions saves the user exactly 1 keystroke (tab|→) when the suggestion is what the user actually intended. 

On the other hand, it forces the user to input 1 or more characters to "correct" every wrong suggestion. 
Given krunner can search in a lot of places, I dare to say the probability of several entries having matching starts is high. That in turn means the average amount of keystrokes needed to correct the auto-completion suggestion will be higher or equal to just typing a bare minimum and then pressing down|down|down to get to the correct entry. I guess the mental effort to check the auto-completion is right is not less than the required to find that the 4th entry in the list is the correct one.

Ofc I don't have the data to back this up, just my personal experience and observations.



Ideally, I would expect krunner to search for what I explicitly type. Results are sorted by whatever history count (or machine learning?) algorithm u currently use, but with a setting to force use alphabetical order (no idea if this already exists). Auto completion requires a tab press to apply its suggestion and update the search query.

Thx for your interest in this report ;)
Comment 4 Alexander Lohnau 2020-06-28 18:11:53 UTC
>If so, it could function as some kind of workaround I guess.
Yes, this was the intention. Also because these bugs are related I thought it is a good idea to keep you up to date :-).

>I'm in no way against offering auto-completion, just against suggestions being automatically "accepted" and 
>searched for without user confirmation by pressing Tab (or right arrow maybe).
This was clear to me and the suggestion sums up the concept of the fish shell completion pretty well. There you have the suggestion as a grey text and have to press → to apply the suggestion.
Comment 5 Alexander Lohnau 2020-07-08 11:36:23 UTC
*** Bug 251205 has been marked as a duplicate of this bug. ***
Comment 6 Alexander Lohnau 2020-08-12 17:46:53 UTC
Created attachment 130832 [details]
The KLineEdit (here in Dolphin) has the kind of functionality we want!
Comment 7 Alexander Lohnau 2023-05-10 08:57:40 UTC
I am working on this right now.
Comment 9 Bug Janitor Service 2023-06-12 19:21:47 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1573
Comment 10 Alexander Lohnau 2023-06-23 13:19:49 UTC
Git commit 9e2b433b69a2e3fe923594691512aaa5f6e87a9d by Alexander Lohnau.
Committed on 23/06/2023 at 13:02.
Pushed by alex into branch 'master'.

kcms/runners: Add new history option for KRunner

Counterpart of https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2915

M  +1    -1    kcms/runners/krunner/krunnersettings.cpp
M  +9    -8    kcms/runners/krunner/krunnersettingsbase.kcfg
M  +1    -0    kcms/runners/krunner/krunnersettingsbase.kcfgc
M  +16   -20   kcms/runners/krunner/ui/main.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/9e2b433b69a2e3fe923594691512aaa5f6e87a9d
Comment 11 Alexander Lohnau 2023-06-27 00:59:52 UTC
Git commit 2f440982378a7e11d4659493a978fbd1ebd107bd by Alexander Lohnau.
Committed on 27/06/2023 at 00:59.
Pushed by alex into branch 'master'.

krunner: Show suggestions as grayed out text, press arrow-right to apply

This way, we do not apply a suggestion without asking the user for it.
Using the grayed out text, it is made clear to the user what the
suggestion is.

Because the old behavior is desirable for existing users, it is still
kept as an option. The code required for it is minimal anyway.
FIXED-IN: 6.0

M  +29   -1    krunner/qml/RunCommand.qml
M  +5    -2    krunner/view.cpp
M  +19   -0    krunner/view.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/2f440982378a7e11d4659493a978fbd1ebd107bd
Comment 12 Fabian Vogt 2023-11-25 23:47:16 UTC
The implementation for this feature caused some regressions, I filed an issue with screenshots: https://invent.kde.org/plasma/plasma-workspace/-/issues/103
Comment 13 Nate Graham 2023-11-29 16:42:48 UTC
Please submit new bug reports for those new issues, thanks.