@@ -677,6 +677,7 @@ def save(self, *args, **kw):
677677class URWIDRepl (repl .Repl ):
678678
679679 _time_between_redraws = .05 # seconds
680+ rl_history_reset = False
680681
681682 def __init__ (self , event_loop , palette , interpreter , config ):
682683 repl .Repl .__init__ (self , interpreter , config )
@@ -1655,7 +1656,7 @@ def handle_input(self, event):
16551656 self .prompt (more )
16561657 # XXX: fetching all history is expensive, but better than nothing
16571658 # for now
1658- self .rl_history = IPythonHistory ( self )
1659+ self .rl_history_reset = True
16591660 elif event == 'ctrl d' :
16601661 # ctrl+d on an empty line exits, otherwise deletes
16611662 if self .edit is not None :
@@ -1665,6 +1666,9 @@ def handle_input(self, event):
16651666 self .main_loop .process_input (['delete' ])
16661667 elif urwid .command_map [event ] == 'cursor up' :
16671668 # "back" from bpython.cli
1669+ if self .rl_history_reset :
1670+ self .rl_history = IPythonHistory (self )
1671+ self .rl_history_reset = False
16681672 self .rl_history .enter (self .edit .get_edit_text ())
16691673 self .edit .set_edit_text ('' )
16701674 self .edit .insert_text (self .rl_history .back ()) # + "#previous")
0 commit comments