code: def preprocess_keyevent(self, event):
          
          # Copy must be done first to be able to copy read-only text parts
          # (otherwise, right below, we would remove selection
          #  if not on current line)
          ctrl = event.modifiers() & Qt.ControlModifier
          meta = event.modifiers() & Qt.MetaModifier    # meta=ctrl in OSX
          if event.key() == Qt.Key_C and \
            ((Qt.MetaModifier | Qt.ControlModifier) & event.modifiers()):
              if meta and sys.platform == 'darwin':
                  self.interrupt()
              elif ctrl:
                  self.copy()
              event.accept()
              return True
          
          if self.new_input_line and ( len(event.text()) or event.key() in \
             (Qt.Key_Up, Qt.Key_Down, Qt.Key_Left, Qt.Key_Right) ):
              self.on_new_line()
          
          return False
docs: Pre-process keypress event:
          return True if event is accepted, false otherwise