mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-08 00:05:09 -04:00
Fixes #18526: Pasting data from clipboard inside Python console causes the text cursor to be moved to the end of the row
This commit is contained in:
parent
bc45258b51
commit
3a5fb9d7bd
@ -244,7 +244,7 @@ class ShellScintilla(QsciScintilla, code.InteractiveInterpreter):
|
|||||||
def get_end_pos(self):
|
def get_end_pos(self):
|
||||||
"""Return (line, index) position of the last character"""
|
"""Return (line, index) position of the last character"""
|
||||||
line = self.lines() - 1
|
line = self.lines() - 1
|
||||||
return (line, len(self.text(line)))
|
return line, len(self.text(line))
|
||||||
|
|
||||||
def is_cursor_at_end(self):
|
def is_cursor_at_end(self):
|
||||||
"""Return True if cursor is at the end of text"""
|
"""Return True if cursor is at the end of text"""
|
||||||
@ -560,8 +560,9 @@ class ShellScintilla(QsciScintilla, code.InteractiveInterpreter):
|
|||||||
if pasteList[-1] != "":
|
if pasteList[-1] != "":
|
||||||
line = pasteList[-1]
|
line = pasteList[-1]
|
||||||
cleanLine = line.replace(">>> ", "").replace("... ", "")
|
cleanLine = line.replace(">>> ", "").replace("... ", "")
|
||||||
|
curpos = self.getCursorPosition()
|
||||||
self.insert(cleanLine)
|
self.insert(cleanLine)
|
||||||
self.move_cursor_to_end()
|
self.setCursorPosition(curpos[0], curpos[1] + len(cleanLine))
|
||||||
|
|
||||||
def insertTextFromFile(self, listOpenFile):
|
def insertTextFromFile(self, listOpenFile):
|
||||||
for line in listOpenFile[:-1]:
|
for line in listOpenFile[:-1]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user