@@ -57,6 +57,7 @@ def __init__(self, coderunner, repl):
5757
5858 def process_event (self , e ):
5959 assert self .has_focus
60+ logger .debug ('fake input processing event %r' , e )
6061 if isinstance (e , events .PasteEvent ):
6162 for ee in e .events :
6263 if ee not in rl_char_sequences :
@@ -71,13 +72,22 @@ def process_event(self, e):
7172 self .repl .run_code_and_maybe_finish ()
7273 elif e in ["<ESC>" ]:
7374 pass
75+ elif e in ['<Ctrl-d>' ]:
76+ if self .current_line == '' :
77+ self .repl .send_to_stdin ('\n ' )
78+ self .has_focus = False
79+ self .current_line = ''
80+ self .cursor_offset = 0
81+ self .repl .run_code_and_maybe_finish (for_code = '' )
82+ else :
83+ pass
7484 elif e in ["\n " , "\r " , "<Ctrl-j>" , "<Ctrl-m>" ]:
7585 line = self .current_line
7686 self .repl .send_to_stdin (line + '\n ' )
7787 self .has_focus = False
7888 self .current_line = ''
7989 self .cursor_offset = 0
80- self .repl .run_code_and_maybe_finish (for_code = line )
90+ self .repl .run_code_and_maybe_finish (for_code = line + ' \n ' )
8191 else : # add normal character
8292 self .add_input_character (e )
8393
@@ -406,7 +416,6 @@ def process_event(self, e):
406416 raise SystemExit ()
407417 elif e in ("\n " , "\r " , "<PADENTER>" , "<Ctrl-j>" , "<Ctrl-m>" ):
408418 self .on_enter ()
409- self .update_completion ()
410419 elif e == '<TAB>' : # tab
411420 self .on_tab ()
412421 self .rl_history .reset ()
0 commit comments