From 3a5fb9d7bd1ca8aa6a4ddbbf051314b79e7153f4 Mon Sep 17 00:00:00 2001 From: Salvatore Larosa Date: Fri, 23 Mar 2018 22:41:00 +0100 Subject: [PATCH] Fixes #18526: Pasting data from clipboard inside Python console causes the text cursor to be moved to the end of the row --- python/console/console_sci.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/console/console_sci.py b/python/console/console_sci.py index d0c4d87ac51..db079daeb81 100644 --- a/python/console/console_sci.py +++ b/python/console/console_sci.py @@ -244,7 +244,7 @@ class ShellScintilla(QsciScintilla, code.InteractiveInterpreter): def get_end_pos(self): """Return (line, index) position of the last character""" line = self.lines() - 1 - return (line, len(self.text(line))) + return line, len(self.text(line)) def is_cursor_at_end(self): """Return True if cursor is at the end of text""" @@ -560,8 +560,9 @@ class ShellScintilla(QsciScintilla, code.InteractiveInterpreter): if pasteList[-1] != "": line = pasteList[-1] cleanLine = line.replace(">>> ", "").replace("... ", "") + curpos = self.getCursorPosition() self.insert(cleanLine) - self.move_cursor_to_end() + self.setCursorPosition(curpos[0], curpos[1] + len(cleanLine)) def insertTextFromFile(self, listOpenFile): for line in listOpenFile[:-1]: