docs: def keyPressEvent(self, event):
          """
          Handle key press event using the defined input handler.
          """
          if self._process.state() != self._process.Running:
              return
          tc = self.textCursor()
          sel_start = tc.selectionStart()
          sel_end = tc.selectionEnd()
          tc.setPosition(self._formatter._last_cursor_pos)
          self.setTextCursor(tc)
          if self.input_handler.key_press_event(event):
              tc.setPosition(sel_start)
              tc.setPosition(sel_end, tc.KeepAnchor)
              self.setTextCursor(tc)
              super(OutputWindow, self).keyPressEvent(event)
          self._formatter._last_cursor_pos = self.textCursor().position()