7976 self.beginUndoAction() |
7977 self.beginUndoAction() |
7977 self.replaceSelectedText(replaceText) |
7978 self.replaceSelectedText(replaceText) |
7978 self.endUndoAction() |
7979 self.endUndoAction() |
7979 self.setSelection(sline, sindex + 1, eline, eindex + 1) |
7980 self.setSelection(sline, sindex + 1, eline, eindex + 1) |
7980 |
7981 |
|
7982 if ( |
|
7983 ev.key() == Qt.Key.Key_Comma |
|
7984 and ev.modifiers() & Qt.KeyboardModifier.KeypadModifier |
|
7985 ): |
|
7986 # Change the numpad ',' to always insert a '.' because that is what |
|
7987 # is needed in programming. |
|
7988 |
|
7989 # Create a new QKeyEvent to substitute the original one |
|
7990 ev = QKeyEvent( |
|
7991 ev.type(), |
|
7992 Qt.Key.Key_Period, |
|
7993 ev.modifiers(), |
|
7994 ".", |
|
7995 ev.isAutoRepeat(), |
|
7996 ev.count(), |
|
7997 ) |
|
7998 |
|
7999 super().keyPressEvent(ev) |
|
8000 return |
|
8001 |
7981 txt = ev.text() |
8002 txt = ev.text() |
7982 |
8003 |
7983 # See it is text to insert. |
8004 # See it is text to insert. |
7984 if len(txt) and txt >= " ": |
8005 if len(txt) and txt >= " ": |
7985 if self.hasSelectedText() and txt in Editor.EncloseChars: |
8006 if self.hasSelectedText() and txt in Editor.EncloseChars: |