Skip to content
Permalink
Browse files

[pyqgis-console] fix undo/redo actions when autocompletion bracket is…

… enabled
  • Loading branch information
slarosa committed Sep 8, 2013
1 parent 982960b commit 0aa9e0318023bee5b778994deb0963be34f08f7a
Showing with 5 additions and 2 deletions.
  1. +5 −2 python/console/console_editor.py
@@ -656,23 +656,26 @@ def keyPressEvent(self, e):
t = unicode(e.text())
## Close bracket automatically
if t in self.opening:
self.beginUndoAction()
i = self.opening.index(t)
if self.hasSelectedText():
self.beginUndoAction()
selText = self.selectedText()
self.removeSelectedText()
if startLine == endLine:
self.insert(self.opening[i] + selText + self.closing[i])
self.setCursorPosition(endLine, endPos+2)
self.endUndoAction()
return
elif startLine < endLine and self.opening[i] in ("'", '"'):
self.insert("'''" + selText + "'''")
self.setCursorPosition(endLine, endPos+3)
self.endUndoAction()
return
else:
self.insert(self.closing[i])
self.endUndoAction()
else:
self.insert(self.closing[i])
self.endUndoAction()
## FIXES #8392 (automatically removes the redundant char
## when autoclosing brackets option is enabled)
if t in [')', ']', '}']:

0 comments on commit 0aa9e03

Please sign in to comment.
You can’t perform that action at this time.