Skip to content

Commit

Permalink
Python console: do not run the last line of the pasted code.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15585 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Mar 23, 2011
1 parent e4ac6e9 commit fc7ca17
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions python/console.py
Expand Up @@ -272,9 +272,12 @@ def insertFromMimeData(self, source):
if source.hasText():
pasteList = QStringList()
pasteList = source.text().split("\n")
for line in pasteList:
self.insertPlainText(line)
self.runCommand(unicode(line))
# with multi-line text also run the commands
for line in pasteList[:-1]:
self.insertPlainText(line)
self.runCommand(unicode(line))
# last line: only paste the text, do not run it
self.insertPlainText(unicode(pasteList[-1]))

def entered(self):
self.cursor.movePosition(QTextCursor.End, QTextCursor.MoveAnchor)
Expand Down

0 comments on commit fc7ca17

Please sign in to comment.