Permalink
Browse files

Only strip whitespace from cell once when filling readline history.

  • Loading branch information...
1 parent cc9ded1 commit be6a69cfec0bf9895da973f5d6fd0f2d6b436a06 @takluyver committed Nov 16, 2011
Showing with 6 additions and 5 deletions.
  1. +6 −5 IPython/core/interactiveshell.py
@@ -1798,15 +1798,16 @@ def refill_readline_hist(self):
for _, _, cell in self.history_manager.get_tail(1000,
include_latest=True):
# Ignore blank lines and consecutive duplicates
- if cell.strip() and cell.rstrip()!=last_cell:
+ cell = cell.rstrip()
+ if cell and (cell != last_cell):
if self.multiline_history:
- self.readline.add_history(py3compat.unicode_to_str(cell.rstrip(),
- stdin_encoding))
+ self.readline.add_history(py3compat.unicode_to_str(cell,
+ stdin_encoding))
else:
for line in cell.splitlines():
self.readline.add_history(py3compat.unicode_to_str(line,
- stdin_encoding))
- last_cell = cell.rstrip()
+ stdin_encoding))
+ last_cell = cell
def set_next_input(self, s):
""" Sets the 'default' input string for the next command line.

0 comments on commit be6a69c

Please sign in to comment.