File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -789,8 +789,20 @@ def start(self):
789789 self .prompt (False )
790790
791791 def keyboard_interrupt (self ):
792- # Do we need to do more here? Break out of multiline input perhaps?
793- self .echo ('KeyboardInterrupt' )
792+ # If the user is currently editing, interrupt him. This
793+ # mirrors what the regular python REPL does.
794+ if self .edit is not None :
795+ # XXX this is a lot of code, and I am not sure it is
796+ # actually enough code. Needs some testing.
797+ self .edit .make_readonly ()
798+ self .edit = None
799+ self .buffer = []
800+ self .echo ('KeyboardInterrupt' )
801+ self .prompt (False )
802+ else :
803+ # I do not quite remember if this is reachable, but let's
804+ # be safe.
805+ self .echo ('KeyboardInterrupt' )
794806
795807 def prompt (self , more ):
796808 # Clear current output here, or output resulting from the
You can’t perform that action at this time.
0 commit comments