##// END OF EJS Templates
Do not push consecutive duplicates when we refill readline history....
Thomas Kluyver -
Show More
@@ -1794,9 +1794,11 b' class InteractiveShell(SingletonConfigurable, Magic):'
1794 # Load the last 1000 lines from history
1794 # Load the last 1000 lines from history
1795 self.readline.clear_history()
1795 self.readline.clear_history()
1796 stdin_encoding = sys.stdin.encoding or "utf-8"
1796 stdin_encoding = sys.stdin.encoding or "utf-8"
1797 last_cell = u""
1797 for _, _, cell in self.history_manager.get_tail(1000,
1798 for _, _, cell in self.history_manager.get_tail(1000,
1798 include_latest=True):
1799 include_latest=True):
1799 if cell.strip(): # Ignore blank lines
1800 # Ignore blank lines and consecutive duplicates
1801 if cell.strip() and cell.rstrip()!=last_cell:
1800 if self.multiline_history:
1802 if self.multiline_history:
1801 self.readline.add_history(py3compat.unicode_to_str(cell.rstrip(),
1803 self.readline.add_history(py3compat.unicode_to_str(cell.rstrip(),
1802 stdin_encoding))
1804 stdin_encoding))
@@ -1804,6 +1806,7 b' class InteractiveShell(SingletonConfigurable, Magic):'
1804 for line in cell.splitlines():
1806 for line in cell.splitlines():
1805 self.readline.add_history(py3compat.unicode_to_str(line,
1807 self.readline.add_history(py3compat.unicode_to_str(line,
1806 stdin_encoding))
1808 stdin_encoding))
1809 last_cell = cell.rstrip()
1807
1810
1808 def set_next_input(self, s):
1811 def set_next_input(self, s):
1809 """ Sets the 'default' input string for the next command line.
1812 """ Sets the 'default' input string for the next command line.
General Comments 0
You need to be logged in to leave comments. Login now