eric6/QScintilla/MiniEditor.py

changeset 8165
61ca9619decb
parent 8158
16a34a0167ba
child 8169
139bd30c52c2
diff -r c8b88e73b56f -r 61ca9619decb eric6/QScintilla/MiniEditor.py
--- a/eric6/QScintilla/MiniEditor.py	Tue Mar 16 17:29:42 2021 +0100
+++ b/eric6/QScintilla/MiniEditor.py	Wed Mar 17 19:54:32 2021 +0100
@@ -80,6 +80,21 @@
         """
         return self.mw.getFileName()
     
+    def editorCommand(self, cmd):
+        """
+        Public method to perform a simple editor command.
+        
+        @param cmd the scintilla command to be performed (integer)
+        """
+        if cmd == QsciScintilla.SCI_DELETEBACK:
+            line, index = self.getCursorPosition()
+            text = self.text(line)[index - 1:index + 1]
+            matchingPairs = ['()', '[]', '{}', '<>', "''", '""']
+            if text in matchingPairs:
+                self.delete()
+        
+        super(MiniScintilla, self).editorCommand(cmd)
+    
     def keyPressEvent(self, ev):
         """
         Protected method to handle the user input a key at a time.
@@ -2986,6 +3001,10 @@
         
         self.__textEdit.setVirtualSpaceOptions(
             Preferences.getEditor("VirtualSpaceOptions"))
+        
+        # to avoid errors due to line endings by pasting
+        self.__textEdit.SendScintilla(
+            QsciScintilla.SCI_SETPASTECONVERTENDINGS, True)
     
     def __setEolMode(self):
         """

eric ide

mercurial