Skip to content

Commit 08ef4f8

Browse files
committedApr 17, 2013
[pyqgis-console] fixes the undo action when comment/uncomment out code in editor
1 parent a56c05a commit 08ef4f8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎python/console/console_editor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ def hideEditor(self):
341341
self.parent.pc.showEditorButton.setChecked(False)
342342

343343
def commentEditorCode(self, commentCheck):
344+
self.beginUndoAction()
344345
if self.hasSelectedText():
345346
startLine, _, endLine, _ = self.getSelection()
346347
for line in range(startLine, endLine + 1):
@@ -355,7 +356,6 @@ def commentEditorCode(self, commentCheck):
355356
self.insert(selCmd[1:])
356357
else:
357358
self.insert(selCmd)
358-
self.setCursorPosition(endLine, selCmd.length() - 2)
359359
else:
360360
line, pos = self.getCursorPosition()
361361
selCmd = self.text(line)
@@ -369,7 +369,7 @@ def commentEditorCode(self, commentCheck):
369369
self.insert(selCmd[1:])
370370
else:
371371
self.insert(selCmd)
372-
self.setCursorPosition(line, selCmd.length() - 2)
372+
self.endUndoAction()
373373

374374
def runScriptCode(self):
375375
tabWidget = self.parent.mw.currentWidget()

0 commit comments

Comments
 (0)
Please sign in to comment.