@@ -351,21 +351,21 @@ def process_event(self, e):
351351 elif e in self .rl_char_sequences :
352352 self .cursor_offset , self .current_line = self .rl_char_sequences [e ](self .cursor_offset , self .current_line )
353353 self .update_completion ()
354+ self .rl_history .reset ()
354355
355356 # readline history commands
356357 elif e in ("KEY_UP" ,) + key_dispatch [self .config .up_one_line_key ]:
357358 self .rl_history .enter (self .current_line )
358359 self .current_line = self .rl_history .back (False ,
359360 search = self .config .curtsies_right_arrow_completion )
360361 self .cursor_offset = len (self .current_line )
361- self .update_completion ()
362362
363363 elif e in ("KEY_DOWN" ,) + key_dispatch [self .config .down_one_line_key ]:
364364 self .rl_history .enter (self .current_line )
365365 self .current_line = self .rl_history .forward (False ,
366366 search = self .config .curtsies_right_arrow_completion )
367367 self .cursor_offset = len (self .current_line )
368- self . update_completion ()
368+
369369 elif e in key_dispatch [self .config .search_key ]: #TODO Not Implemented
370370 pass
371371 #TODO add rest of history commands
@@ -402,8 +402,10 @@ def process_event(self, e):
402402 self .update_completion ()
403403 elif e == '\t ' : # tab
404404 self .on_tab ()
405+ self .rl_history .reset ()
405406 elif e in ("KEY_BTAB" ,): # shift-tab
406407 self .on_tab (back = True )
408+ self .rl_history .reset ()
407409 elif e in key_dispatch [self .config .undo_key ]: #ctrl-r for undo
408410 self .undo ()
409411 self .update_completion ()
@@ -416,13 +418,15 @@ def process_event(self, e):
416418 g .switch ()
417419 elif e in key_dispatch [self .config .external_editor_key ]:
418420 self .send_session_to_external_editor ()
421+ self .rl_history .reset ()
419422 #TODO add PAD keys hack as in bpython.cli
420423 elif e in ["\x18 " ]:
421424 self .send_current_block_to_external_editor ()
422425 elif e in ["\x1b " ]: #ESC
423426 pass
424427 else :
425428 self .add_normal_character (e )
429+ self .rl_history .reset ()
426430 self .update_completion ()
427431
428432 def on_enter (self , insert_into_history = True ):
0 commit comments