118 |
118 |
119 elif ( |
119 elif ( |
120 cmd in (QsciScintilla.SCI_LOWERCASE, QsciScintilla.SCI_UPPERCASE) |
120 cmd in (QsciScintilla.SCI_LOWERCASE, QsciScintilla.SCI_UPPERCASE) |
121 and self.hasSelectedText() |
121 and self.hasSelectedText() |
122 ): |
122 ): |
123 startLine, startIndex, endLine, _ = self.getSelection() |
123 startLine, startIndex, endLine, endIndex = self.getSelection() |
124 selectedText = self.selectedText() |
124 selectedText = self.selectedText() |
125 replacementText = ( |
125 replacementText = ( |
126 selectedText.upper() |
126 selectedText.upper() |
127 if cmd == QsciScintilla.SCI_UPPERCASE |
127 if cmd == QsciScintilla.SCI_UPPERCASE |
128 else selectedText.lower() |
128 else selectedText.lower() |
129 ) |
129 ) |
130 self.replaceSelectedText(replacementText) |
130 self.replaceSelectedText(replacementText) |
131 self.setSelection( |
131 self.setSelection(startLine, startIndex, endLine, endIndex) |
132 startLine, startIndex, endLine, len(replacementText.splitlines()[-1]) |
|
133 ) |
|
134 return |
132 return |
135 |
133 |
136 super().editorCommand(cmd) |
134 super().editorCommand(cmd) |
137 |
135 |
138 def keyPressEvent(self, ev): |
136 def keyPressEvent(self, ev): |