Bug 314690

Summary: KRunner command history changed behavior (to worse) in 4.10
Product: [Plasma] krunner Reporter: Bartosz Brachaczek <b.brachaczek>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: franz.trischberger, inform, jjm, magnus.lidbom, mfraz74+kde, teet.talviste
Priority: NOR Keywords: regression
Version: 4.10.0   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 4.11.7
Sentry Crash Report:
Attachments: Patch to fix

Description Bartosz Brachaczek 2013-02-08 16:23:02 UTC
Before 4.10, command history in KRunner worked more or less like in Bash:
$ command1
<Return>
$ command2
<Return>
<Up> yields:
$ command2
<Return>
another <Up> yields:
$ command2

Now, in 4.10, it resembles cmd.exe behavior:
$ command1
<Return>
$ command2
<Return>
<Up> yields:
$ command2
<Return>
another <Up> yields:
$ command1

Which I really don't like. I hope it is an unintended regression. I often use KRunner to run only one specific command, and my pattern to do was: <Alt>+<F2>; <Up> n times, where n was usually 1; <Return>. Now I sometimes need to use <Down> instead of <Up>.

Also, I find this new behavior inconsistent with the Qalculate plasmoid. I even remember Qalculate plasmoid having cmd.exe-like behavior in its early days, but it's been changed to Bash-like to behave like all the other components (KRunner, Bash and thus Konsole). I guess almost all Linux users who are used to typing commands are used to the Bash-like command history behavior.

Reproducible: Always

Steps to Reproduce:
1. Press <Alt>+<F2>.
2. Type a command, e.g., "kate"; press <Return>.
3. Press <Alt>+<F2>.
4. Press <Up>; press <Return>. Kate is started again.
5. Press <Alt>+<F2>.
6. Press <Up>. Now I'd expect the command to be "kate", but it's not.
Actual Results:  
In step 6 the command from history is not "kate". It's cmd.exe-like behavior.

Expected Results:  
In step 6 the command from history should be "kate". Please restore Bash-like behavior.
Comment 1 Franz Trischberger 2013-02-08 19:40:09 UTC
Simply start several different applications, that makes things easier.
You will see that krunner stores the last used index, pressing <Up> increments the index - but Running the command by pressing <Enter> won't reset it.
Comment 2 Bartosz Brachaczek 2013-02-08 20:04:53 UTC
(In reply to comment #1)
> (...) Running the command by pressing <Enter> won't reset it.

Yes, it's what this bug report is about. I think that closing KRunner widget by pressing <Esc>/clicking 'X'/whatever should also reset the index/cursor, although it wasn't the case in 4.9.x.
Comment 3 Teet Talviste 2013-03-08 23:01:14 UTC
This is utterly annoying, i keep killing and starting stuff unintentionally.
Comment 4 Magnus Lidbom 2013-06-14 08:00:48 UTC
Ah, so that's what it is doing! 
It's been driving me insane. I've almost completely given up on using the history because it never does what I expect it to. 
Even after I've had the logic explained to me It seems to be some sort of memory and logic stunt to try and figure out how to find the command I'm after. 

Please revert this behavior

For the simple implementation usage can be described like this: 
<up> times X:  The Xth "command-executed-ago".
That's all!

I would say that unless you can provide a simple, understandable, description of how to find the command you're after in the general case you must revert the behavior.
Comment 5 Mark Fraser 2013-09-03 15:03:33 UTC
Please revert this to the previous behaviour. This new way of doing things is really annoying and as has been said completely the opposite of how it should work.
Comment 6 Andreas Klöckner 2013-11-26 05:18:18 UTC
Seconded, please revert.
Comment 7 Jonathan Marten 2014-01-12 15:25:40 UTC
Created attachment 84599 [details]
Patch to fix

This patch fixes the bug for me.
If any reporters can compile from source, please test.
Comment 8 Magnus Lidbom 2014-01-12 15:43:55 UTC
Thank you so much for that patch. 
At last I can once more use krunner to launch things without tearing my hair out in frustration every time I try to find something in the history. I works normally again.

For any other gentoo users out there: Just save the patch as /etc/portage/patches/kde-base/krunner/krunner-history-314690.patch and re-emerge krunner.
Comment 9 Jonathan Marten 2014-01-21 19:37:18 UTC
https://git.reviewboard.kde.org/r/115183/
Comment 10 Jonathan Marten 2014-02-15 09:21:30 UTC
Git commit 5ec7c15faec9d3d9d26c43acfcd144d9b3234896 by Jonathan Marten.
Committed on 12/01/2014 at 15:31.
Pushed by marten into branch 'KDE/4.11'.

Reset the search history index just before showing
REVIEW:115183

M  +2    -0    krunner/interfaces/default/interface.cpp

http://commits.kde.org/kde-workspace/5ec7c15faec9d3d9d26c43acfcd144d9b3234896