src/eric7/QScintilla/Editor.py

branch
server
changeset 10718
c9252721680b
parent 10708
a6094987c1be
parent 10715
5e000d8fc96b
child 10719
34901362f648
--- a/src/eric7/QScintilla/Editor.py	Thu May 16 17:14:26 2024 +0200
+++ b/src/eric7/QScintilla/Editor.py	Sun May 19 17:48:07 2024 +0200
@@ -37,6 +37,7 @@
     QActionGroup,
     QCursor,
     QFont,
+    QKeyEvent,
     QPainter,
     QPalette,
     QPixmap,
@@ -8085,6 +8086,26 @@
             self.endUndoAction()
             self.setSelection(sline, sindex + 1, eline, eindex + 1)
 
+        if (
+            ev.key() == Qt.Key.Key_Comma
+            and ev.modifiers() & Qt.KeyboardModifier.KeypadModifier
+        ):
+            # Change the numpad ',' to always insert a '.' because that is what
+            # is needed in programming.
+
+            # Create a new QKeyEvent to substitute the original one
+            ev = QKeyEvent(
+                ev.type(),
+                Qt.Key.Key_Period,
+                ev.modifiers(),
+                ".",
+                ev.isAutoRepeat(),
+                ev.count(),
+            )
+
+            super().keyPressEvent(ev)
+            return
+
         txt = ev.text()
 
         # See it is text to insert.

eric ide

mercurial