Skip to content

Commit fc7ca17

Browse files
author
wonder
committed
Python console: do not run the last line of the pasted code.
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15585 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent e4ac6e9 commit fc7ca17

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

python/console.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,12 @@ def insertFromMimeData(self, source):
272272
if source.hasText():
273273
pasteList = QStringList()
274274
pasteList = source.text().split("\n")
275-
for line in pasteList:
276-
self.insertPlainText(line)
277-
self.runCommand(unicode(line))
275+
# with multi-line text also run the commands
276+
for line in pasteList[:-1]:
277+
self.insertPlainText(line)
278+
self.runCommand(unicode(line))
279+
# last line: only paste the text, do not run it
280+
self.insertPlainText(unicode(pasteList[-1]))
278281

279282
def entered(self):
280283
self.cursor.movePosition(QTextCursor.End, QTextCursor.MoveAnchor)

0 commit comments

Comments
 (0)