7833 |
7833 |
7834 elif ( |
7834 elif ( |
7835 cmd in (QsciScintilla.SCI_LOWERCASE, QsciScintilla.SCI_UPPERCASE) |
7835 cmd in (QsciScintilla.SCI_LOWERCASE, QsciScintilla.SCI_UPPERCASE) |
7836 and self.hasSelectedText() |
7836 and self.hasSelectedText() |
7837 ): |
7837 ): |
7838 startLine, startIndex, endLine, _ = self.getSelection() |
7838 startLine, startIndex, endLine, endIndex = self.getSelection() |
7839 selectedText = self.selectedText() |
7839 selectedText = self.selectedText() |
7840 replacementText = ( |
7840 replacementText = ( |
7841 selectedText.upper() |
7841 selectedText.upper() |
7842 if cmd == QsciScintilla.SCI_UPPERCASE |
7842 if cmd == QsciScintilla.SCI_UPPERCASE |
7843 else selectedText.lower() |
7843 else selectedText.lower() |
7844 ) |
7844 ) |
7845 self.replaceSelectedText(replacementText) |
7845 self.replaceSelectedText(replacementText) |
7846 endIndex = ( |
|
7847 startIndex + len(replacementText) |
|
7848 if len(replacementText.splitlines()) <= 1 |
|
7849 else len(replacementText.splitlines()[-1]) |
|
7850 ) |
|
7851 self.setSelection(startLine, startIndex, endLine, endIndex) |
7846 self.setSelection(startLine, startIndex, endLine, endIndex) |
7852 return |
7847 return |
7853 |
7848 |
7854 super().editorCommand(cmd) |
7849 super().editorCommand(cmd) |
7855 |
7850 |