After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 613731 - [runDialog] Don't add duplicates to the history
[runDialog] Don't add duplicates to the history
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2010-03-23 19:03 UTC by drago01
Modified: 2010-03-29 14:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Don't add duplicates to the history (1.08 KB, patch)
2010-03-23 19:04 UTC, drago01
committed Details | Review
Avoid saving any duplicates in the history (1.55 KB, patch)
2010-03-23 19:46 UTC, drago01
none Details | Review
[runDialog] Avoid saving any duplicates in the history (1.49 KB, patch)
2010-03-23 20:01 UTC, drago01
none Details | Review
[runDialog] Avoid saving any duplicates in the history (1.49 KB, patch)
2010-03-23 20:05 UTC, drago01
none Details | Review

Description drago01 2010-03-23 19:03:44 UTC
It is annoying to have 10x "r" saved in the history ...
Comment 1 drago01 2010-03-23 19:04:12 UTC
Created attachment 156910 [details] [review]
Don't add duplicates to the history

When the user runs the same command as the last one saved there
is no need to save it again, otherwise we the history might end
up having lots of dupes which makes searching for an old command
harder.
Comment 2 Colin Walters 2010-03-23 19:14:24 UTC
Review of attachment 156910 [details] [review]:

Could use a comment "// Avoid saving duplicates".
Comment 3 Maxim Ermilov 2010-03-23 19:22:29 UTC
May be better idea is save last command and remove dups.
Comment 4 drago01 2010-03-23 19:24:54 UTC
(In reply to comment #3)
> May be better idea is save last command and remove dups.

Sorry pushed it before seeing your reply.

So you are proposing to to remove all duplicates from the list?

ex:
a
b
c
d
a
d
a

You'd only save
b
c
d
d
a

?
Comment 5 drago01 2010-03-23 19:25:23 UTC
(In reply to comment #4)

> You'd only save
> b
> c
> d
> a
> 
> ?
Comment 6 Maxim Ermilov 2010-03-23 19:28:11 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > May be better idea is save last command and remove dups.
> 
> Sorry pushed it before seeing your reply.
> 
> So you are proposing to to remove all duplicates from the list?
> 
> ex:
> a
> b
> c
> d
> a
> d
> a
> 
> You'd only save
> b
> c
> d
> d
> a
> 
> ?
yes. I can expect that last command is a.
Comment 7 drago01 2010-03-23 19:46:04 UTC
Created attachment 156915 [details] [review]
Avoid saving any duplicates in the history

Instead of avoiding duplicates only at the end of the list,
avoid them altogether.
Comment 8 drago01 2010-03-23 19:47:48 UTC
(In reply to comment #2)
> Review of attachment 156910 [details] [review]:
> 
> Could use a comment "// Avoid saving duplicates".

Gah ... I pushed the version without the comment :/
Comment 9 Florian Müllner 2010-03-23 19:52:01 UTC
Mmmh, the pushed version is what good old bash is doing (when HISTCONTROL=ignoredups is set) ...
Comment 10 drago01 2010-03-23 20:01:35 UTC
Created attachment 156918 [details] [review]
[runDialog] Avoid saving any duplicates in the history

*) Use filter() instead of a loop ...

Florian has a valid point though ... so not sure which version we actually want.
Comment 11 drago01 2010-03-23 20:05:03 UTC
Created attachment 156920 [details] [review]
[runDialog] Avoid saving any duplicates in the history
Comment 12 Maxim Ermilov 2010-03-23 20:06:53 UTC
(In reply to comment #9)
> Mmmh, the pushed version is what good old bash is doing (when
> HISTCONTROL=ignoredups is set) ...

It can be configurable.
In my opinion, The most useful in history is last command. So I should expect it.
Example:
a
....[long list]
a
What I expect see when put 'up arrow'?
Comment 13 Florian Müllner 2010-03-23 20:47:12 UTC
(In reply to comment #12)
> In my opinion, The most useful in history is last command.

Definitively true, but I think both patch versions do that already (I didn't apply the new one, but at least the pushed one does).

I don't think it makes sense to add an option for this - this is gnome after all ;)

Seriously, the first patch is slightly faster and catches a good part of duplicates, the second patch is slightly slower and catches all duplicates - just pick one and be done with it ...

(Note that this does _not_ count as review)
Comment 14 Owen Taylor 2010-03-23 21:10:00 UTC
I've no experience with Bash's IGNOREDUPs, but I would find it annoying if 'ls' was thousands of commands up in my history because I first typed it on this machine months ago. It seems right that typing a command should move it to the closest part of the history.
Comment 15 drago01 2010-03-23 21:42:23 UTC
(In reply to comment #14)
> I've no experience with Bash's IGNOREDUPs, but I would find it annoying if 'ls'
> was thousands of commands up in my history because I first typed it on this
> machine months ago. It seems right that typing a command should move it to the
> closest part of the history.

Err ... that is not how the patch works .. it would remove the ls that is "thousands of commands up in the list" and add the new one to the end of the list.

So "...,ls,...." you type ls it ends up being "......,ls".

(I don't have a strong opinion on which one should go in though)
Comment 16 Florian Müllner 2010-03-23 21:46:13 UTC
(In reply to comment #14)
> It seems right that typing a command should move it to the
> closest part of the history.

My point here was that both patches should behave like this already (though I only ran the pushed one).

(IGNOREDUPS reduces repeated commands to a single history entry - so "ls; ls -a; ls; ls" would become "ls; ls -a; ls")
Comment 17 Colin Walters 2010-03-29 14:15:03 UTC
Let's go with the pushed patch.