Skip to content

Commit 3a5fb9d

Browse files
committed
Fixes #18526: Pasting data from clipboard inside Python console causes the text cursor to be moved to the end of the row
1 parent bc45258 commit 3a5fb9d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

python/console/console_sci.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def getTextLength(self):
244244
def get_end_pos(self):
245245
"""Return (line, index) position of the last character"""
246246
line = self.lines() - 1
247-
return (line, len(self.text(line)))
247+
return line, len(self.text(line))
248248

249249
def is_cursor_at_end(self):
250250
"""Return True if cursor is at the end of text"""
@@ -560,8 +560,9 @@ def insertFromDropPaste(self, textDP):
560560
if pasteList[-1] != "":
561561
line = pasteList[-1]
562562
cleanLine = line.replace(">>> ", "").replace("... ", "")
563+
curpos = self.getCursorPosition()
563564
self.insert(cleanLine)
564-
self.move_cursor_to_end()
565+
self.setCursorPosition(curpos[0], curpos[1] + len(cleanLine))
565566

566567
def insertTextFromFile(self, listOpenFile):
567568
for line in listOpenFile[:-1]:

0 commit comments

Comments
 (0)