code: def exit(self):
          
          on_exit = self.application.on_exit
          self._exit_flag = True
          self._redraw()
  
          if on_exit == AbortAction.RAISE_EXCEPTION:
              def eof_error():
                  raise EOFError()
              self._set_return_callable(eof_error)
  
          elif on_exit == AbortAction.RETRY:
              self.reset()
              self.renderer.request_absolute_cursor_position()
              self.current_buffer.reset()
  
          elif on_exit == AbortAction.RETURN_NONE:
              self.set_return_value(None)
docs: Set exit. When Control-D has been pressed.