[QGIS Commit] r15729 - trunk/qgis/python

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Apr 16 11:21:18 EDT 2011


Author: borysiasty
Date: 2011-04-16 08:21:18 -0700 (Sat, 16 Apr 2011)
New Revision: 15729

Modified:
   trunk/qgis/python/console.py
Log:
fix #3712

Modified: trunk/qgis/python/console.py
===================================================================
--- trunk/qgis/python/console.py	2011-04-16 14:24:09 UTC (rev 15728)
+++ trunk/qgis/python/console.py	2011-04-16 15:21:18 UTC (rev 15729)
@@ -267,11 +267,13 @@
 
   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)



More information about the QGIS-commit mailing list