Bug 483412 - When search field has focus, End key goes to the last entry in the results view, not the end of the search field
Summary: When search field has focus, End key goes to the last entry in the results vi...
Status: RESOLVED FIXED
Alias: None
Product: krunner
Classification: Plasma
Component: general (show other bugs)
Version: 6.0.1
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: regression, usability
Depends on:
Blocks:
 
Reported: 2024-03-13 08:40 UTC by András Manţia
Modified: 2024-11-27 20:39 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description András Manţia 2024-03-13 08:40:58 UTC
SUMMARY
As opposed to KRunner 5, the End key doesn't go to the end of the command lineedit, but instead jumps to the end of the list which is very annoying behavior change.


STEPS TO REPRODUCE
1.  Start to type something that is already in the command history of Krunner
2.  After a few chars the rest appears in greyed out color
3.  Press End key


OBSERVED RESULT
The last entry from the dropdown is selected which can be completely different from what you want, eg. a contact or such.

EXPECTED RESULT
The cursors jumps to the end of the lineedit as you would have typed the whole command from history.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: X11
(available in About System)
KDE Plasma Version:  6.0.1
KDE Frameworks Version: 6.0.0
Qt Version:  6.6.2
Comment 1 Paul Worrall 2024-03-13 09:03:40 UTC
This keeps tripping me up too!  The Right-Arrow key now goes to the end of the line.
Comment 2 Nate Graham 2024-03-13 21:36:33 UTC
Only if the results view is focused, though.; if the text field is focused, then the Home and End keys behave the way you want. As such, this was an intentional change. If you want to quick focus the text field again, you can hit Ctrl+F.
Comment 3 András Manţia 2024-03-13 22:34:41 UTC
Sorry, but you are wrong. As the description says, this happens when you type in the lineedit. That implies the lineedit has the focus. In any other lineedit pressing end goes to the end of the text, not somewhere else. Just try it. Or try what you have suggested: press CTRL-F and End.
Comment 4 Nate Graham 2024-03-13 22:45:19 UTC
Oh weird, this indeed does not work like it's supposed to. That's only supposed to happen when the text field doesn't have focus.
Comment 5 András Manţia 2024-03-13 23:09:12 UTC
Here is a proposed patch (couldn't test as right now I have some config issues to build plasma-workspace):
diff --git a/krunner/qml/RunCommand.qml b/krunner/qml/RunCommand.qml
index d7f174d938..48843057f4 100644
--- a/krunner/qml/RunCommand.qml
+++ b/krunner/qml/RunCommand.qml
@@ -228,16 +228,17 @@ ColumnLayout {
                         event.accepted = true;
                     }
                 }
+
+                var inCompletionMode = runnerWindow.historyBehavior === HistoryBehavior.CompletionSuggestion
+                    && fadedTextCompletion.text.length > 0;
                 // We only need to handle the Key_End case, the first item is focused by default
-                if (event.key === Qt.Key_End && results.count > 0 && cursorPosition === text.length) {
+                if (event.key === Qt.Key_End && results.count > 0 && cursorPosition === text.length && !inCompletionMode) {
                     results.currentIndex = results.count - 1
                     event.accepted = true;
                     focusCurrentListView()
                 }
-                if (runnerWindow.historyBehavior === HistoryBehavior.CompletionSuggestion
-                    && fadedTextCompletion.text.length > 0
-                    && cursorPosition === text.length
-                    && event.key === Qt.Key_Right
+                if (inCompletionMode && cursorPosition === text.length
+                    && (event.key === Qt.Key_Right || event.key == Qt.Key_End)
                 ) {
                     queryField.text = fadedTextCompletion.text
                     fadedTextCompletion.text = ""
Comment 6 Nate Graham 2024-11-27 20:39:50 UTC
Can't reproduce anymore in git master; looks fixed now.