Drop consecutive duplicates when refilling readline history #1003

merged 4 commits into from Nov 20, 2011


None yet

3 participants


I'd better fix that bug if I'm getting a tshirt for it.

This operates at the cell level, even if the user disables multiline_history in the terminal, so you can define a multiline function twice, and only have to flip through it once after you start a new session.

There's an added bonus fix for setting the next input at the terminal on Python 3.


Aside: the equivalent thing also needs fixing in the Qt console. I'll see if I can track down the relevant code and add it to this PR.


Found the relevant bit for the Qt console too.

@minrk minrk and 1 other commented on an outdated diff Nov 15, 2011
@@ -1804,6 +1806,7 @@ class InteractiveShell(SingletonConfigurable, Magic):
for line in cell.splitlines():
+ last_cell = cell.rstrip()
minrk Nov 15, 2011 Member

You can eliminate these three strip()/rstrip() calls by using a single stripped = cell.rstrip(), and if stripped and stripped != last_cell:, yes?

takluyver Nov 16, 2011 Member

Good point. Done.

fperez commented Nov 20, 2011

Looks great, works great, and fixes a really annoying little regression.

Great job, as always. Totally deserving of the issue #1000 award!! :) Will merge now, thanks a lot.

@fperez fperez merged commit 5e71407 into ipython:master Nov 20, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment