Mon, 19 Sep 2022 10:42:51 +0200
Editor, Mini Editor
- implemented a workaround for QScintilla not converting non-ASCII characters to upper or lower case (see Issue 443).
src/eric7/QScintilla/Editor.py | file | annotate | diff | comparison | revisions | |
src/eric7/QScintilla/MiniEditor.py | file | annotate | diff | comparison | revisions |
--- a/src/eric7/QScintilla/Editor.py Mon Sep 19 10:13:15 2022 +0200 +++ b/src/eric7/QScintilla/Editor.py Mon Sep 19 10:42:51 2022 +0200 @@ -7780,6 +7780,23 @@ if text in matchingPairs: self.delete() + elif ( + cmd in (QsciScintilla.SCI_LOWERCASE, QsciScintilla.SCI_UPPERCASE) + and self.hasSelectedText() + ): + startLine, startIndex, endLine, _ = self.getSelection() + selectedText = self.selectedText() + replacementText = ( + selectedText.upper() + if cmd == QsciScintilla.SCI_UPPERCASE + else selectedText.lower() + ) + self.replaceSelectedText(replacementText) + self.setSelection( + startLine, startIndex, endLine, len(replacementText.splitlines()[-1]) + ) + return + super().editorCommand(cmd) def __applyTemplate(self, templateName, language):
--- a/src/eric7/QScintilla/MiniEditor.py Mon Sep 19 10:13:15 2022 +0200 +++ b/src/eric7/QScintilla/MiniEditor.py Mon Sep 19 10:42:51 2022 +0200 @@ -112,6 +112,23 @@ if text in matchingPairs: self.delete() + elif ( + cmd in (QsciScintilla.SCI_LOWERCASE, QsciScintilla.SCI_UPPERCASE) + and self.hasSelectedText() + ): + startLine, startIndex, endLine, _ = self.getSelection() + selectedText = self.selectedText() + replacementText = ( + selectedText.upper() + if cmd == QsciScintilla.SCI_UPPERCASE + else selectedText.lower() + ) + self.replaceSelectedText(replacementText) + self.setSelection( + startLine, startIndex, endLine, len(replacementText.splitlines()[-1]) + ) + return + super().editorCommand(cmd) def keyPressEvent(self, ev):