mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-15 00:07:25 -05:00
[pyqgis-console] fix undo/redo actions when autocompletion bracket is enabled
This commit is contained in:
parent
214ef1d591
commit
28dbe74ba5
@ -656,23 +656,26 @@ class Editor(QsciScintilla):
|
||||
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 [')', ']', '}']:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user