Wed, 17 Mar 2021 19:54:32 +0100
Editor
- added capability to delete the matching brace if the cursor is in between them (e.g. {}) and backspace is pressed
--- a/docs/changelog Tue Mar 16 17:29:42 2021 +0100 +++ b/docs/changelog Wed Mar 17 19:54:32 2021 +0100 @@ -5,6 +5,9 @@ - Debugger -- extended the Start... dialogs to allow to override some global configuration settings (redirect stdin/stdout/stderr) +- Editor + -- added capability to delete the matching brace if the cursor is + in between them (e.g. {}) and backspace is pressed - Pip Interface -- added support for a re-installation of selected packages - Shell
--- a/eric6/QScintilla/Editor.py Tue Mar 16 17:29:42 2021 +0100 +++ b/eric6/QScintilla/Editor.py Wed Mar 17 19:54:32 2021 +0100 @@ -4714,6 +4714,9 @@ self.setVirtualSpaceOptions( Preferences.getEditor("VirtualSpaceOptions")) + # to avoid errors due to line endings by pasting + self.SendScintilla(QsciScintilla.SCI_SETPASTECONVERTENDINGS, True) + self.__markerMap.setEnabled(True) def __setEolMode(self): @@ -7723,6 +7726,13 @@ for t in templateNames]) return + elif cmd == QsciScintilla.SCI_DELETEBACK: + line, index = self.getCursorPosition() + text = self.text(line)[index - 1:index + 1] + matchingPairs = ['()', '[]', '{}', '<>', "''", '""'] + if text in matchingPairs: + self.delete() + super(Editor, self).editorCommand(cmd) def __applyTemplate(self, templateName, language):
--- 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): """