Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicates when refilling readline history #1000

Closed
takluyver opened this issue Nov 14, 2011 · 7 comments
Closed

Remove duplicates when refilling readline history #1000

takluyver opened this issue Nov 14, 2011 · 7 comments
Assignees
Milestone

Comments

@takluyver
Copy link
Member

Readline by default only keeps one copy of consecutive duplicates in history, but when we refill it from the history database, we push those duplicates multiple times. It should be an easy fix in refill_readline_hist.

@antoine-levitt
Copy link

Are you saying that the way to fix this is to put duplicate lines in the history, but not refill readline's? Isn't it better to simply not add them in the first place?

@takluyver
Copy link
Member Author

Our history is supposed to be a record of what you've executed - for instance, running a += 1 three times is different from running it once. Also, it's numbered to correspond with the In [1]: prompt numbers you see in a session, so one history entry is stored each time that number is incremented.

@minrk
Copy link
Member

minrk commented Nov 14, 2011

Right - we do not want to de-dupe the actual record of your actions, because then it is no longer accurate, and breaks reproducibility. We only want to de-dupe readline, so that we skip repeating entries when hitting the up arrow, etc.

@fperez
Copy link
Member

fperez commented Nov 15, 2011

Agreed. In fact, it used to work without the dupes a while back, I'm not exactly sure when it changed. Was it when we introduced the sqlite backend or later, do you guys know?

@takluyver
Copy link
Member Author

I don't think I accounted for it when I did the sqlite stuff initially, so my guess would be then. I can reproduce it in 0.11.

PR coming up in a few minutes.

@fperez
Copy link
Member

fperez commented Nov 20, 2011

Closed by #1003, I forgot to put that in the commit comment.

@fperez fperez closed this as completed Nov 20, 2011
mdboom pushed a commit to mdboom/ipython that referenced this issue Dec 2, 2011
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
@takluyver takluyver mentioned this issue Nov 20, 2014
@dashesy
Copy link

dashesy commented May 22, 2015

I see duplicates when going back in history in 3.0.0 (QtConsole), it is not something that can be reproduced with confidence but anyone using IPython for long enough time should have noticed this. Maybe QtConsole is not used as much and thus not get tested like the Notebook?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants