Show More
@@ -233,6 +233,11 b' class TerminalInteractiveShell(InteractiveShell):' | |||||
233 | """Store multiple lines as a single entry in history""" |
|
233 | """Store multiple lines as a single entry in history""" | |
234 | if self.multiline_history and self.has_readline and source_raw.rstrip(): |
|
234 | if self.multiline_history and self.has_readline and source_raw.rstrip(): | |
235 | hlen = self.readline.get_current_history_length() |
|
235 | hlen = self.readline.get_current_history_length() | |
|
236 | ||||
|
237 | # nothing changed do nothing, e.g. when rl removes consecutive dups | |||
|
238 | if self.hlen_before_cell == hlen: | |||
|
239 | return | |||
|
240 | ||||
236 | for i in range(hlen - self.hlen_before_cell): |
|
241 | for i in range(hlen - self.hlen_before_cell): | |
237 | self.readline.remove_history_item(hlen - i - 1) |
|
242 | self.readline.remove_history_item(hlen - i - 1) | |
238 | stdin_encoding = sys.stdin.encoding or "utf-8" |
|
243 | stdin_encoding = sys.stdin.encoding or "utf-8" |
@@ -73,12 +73,13 b' class InteractiveShellTestCase(unittest.TestCase):' | |||||
73 |
|
73 | |||
74 | #start cell |
|
74 | #start cell | |
75 | ip.hlen_before_cell = ip.readline.get_current_history_length() |
|
75 | ip.hlen_before_cell = ip.readline.get_current_history_length() | |
|
76 | # nothing added to rl history, should do nothing | |||
76 | ip._replace_rlhist_multiline(u'sourc€\nsource2') |
|
77 | ip._replace_rlhist_multiline(u'sourc€\nsource2') | |
77 |
|
78 | |||
78 | self.assertEquals(ip.readline.get_current_history_length(), |
|
79 | self.assertEquals(ip.readline.get_current_history_length(), | |
79 | ip.hlen_before_cell) |
|
80 | ip.hlen_before_cell) | |
80 |
hist = self.rl_hist_entries(ip.readline, |
|
81 | hist = self.rl_hist_entries(ip.readline, 2) | |
81 |
self.assertEquals(hist, ghist |
|
82 | self.assertEquals(hist, ghist) | |
82 |
|
83 | |||
83 |
|
84 | |||
84 | @skipif(not get_ipython().has_readline, 'no readline') |
|
85 | @skipif(not get_ipython().has_readline, 'no readline') |
General Comments 0
You need to be logged in to leave comments.
Login now