File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -656,23 +656,26 @@ def keyPressEvent(self, e):
656
656
t = unicode (e .text ())
657
657
## Close bracket automatically
658
658
if t in self .opening :
659
+ self .beginUndoAction ()
659
660
i = self .opening .index (t )
660
661
if self .hasSelectedText ():
661
- self .beginUndoAction ()
662
662
selText = self .selectedText ()
663
663
self .removeSelectedText ()
664
664
if startLine == endLine :
665
665
self .insert (self .opening [i ] + selText + self .closing [i ])
666
666
self .setCursorPosition (endLine , endPos + 2 )
667
+ self .endUndoAction ()
667
668
return
668
669
elif startLine < endLine and self .opening [i ] in ("'" , '"' ):
669
670
self .insert ("'''" + selText + "'''" )
671
+ self .setCursorPosition (endLine , endPos + 3 )
672
+ self .endUndoAction ()
670
673
return
671
674
else :
672
675
self .insert (self .closing [i ])
673
- self .endUndoAction ()
674
676
else :
675
677
self .insert (self .closing [i ])
678
+ self .endUndoAction ()
676
679
## FIXES #8392 (automatically removes the redundant char
677
680
## when autoclosing brackets option is enabled)
678
681
if t in [')' , ']' , '}' ]:
You can’t perform that action at this time.
0 commit comments