From a8c2cfc2efce2c953eecae19f5bfc6db9f094dae Mon Sep 17 00:00:00 2001 From: borysiasty Date: Sat, 16 Apr 2011 15:21:18 +0000 Subject: [PATCH] fix #3712 git-svn-id: http://svn.osgeo.org/qgis/trunk@15729 c8812cc2-4d05-0410-92ff-de0c093fc19c --- python/console.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/console.py b/python/console.py index 6787cfe063d..eb47f31e7b7 100755 --- a/python/console.py +++ b/python/console.py @@ -267,11 +267,13 @@ class PythonEdit(QTextEdit, code.InteractiveInterpreter): def insertFromMimeData(self, source): self.cursor = self.textCursor() - self.cursor.movePosition(QTextCursor.End, QTextCursor.MoveAnchor, 1) - self.setTextCursor(self.cursor) if source.hasText(): pasteList = QStringList() pasteList = source.text().split("\n") + # move the cursor to the end only if the text is multi-line or is going to be pasted not into the last line + if (len(pasteList) > 1) or (not self.isCursorInEditionZone()): + self.cursor.movePosition(QTextCursor.End, QTextCursor.MoveAnchor, 1) + self.setTextCursor(self.cursor) # with multi-line text also run the commands for line in pasteList[:-1]: self.insertPlainText(line)