code: def paste(self):
          
          text = to_text_string(QApplication.clipboard().text())
          if len(text.splitlines()) > 1:
              # Multiline paste
              if self.new_input_line:
                  self.on_new_line()
              self.remove_selected_text() # Remove selection, eventually
              end = self.get_current_line_from_cursor()
              lines = self.get_current_line_to_cursor() + text + end
              self.clear_line()
              self.execute_lines(lines)
              self.move_cursor(-len(end))
          else:
              # Standard paste
              ShellBaseWidget.paste(self)
docs: Reimplemented slot to handle multiline paste action