src/eric7/QScintilla/Editor.py

branch
eric7-maintenance
changeset 10733
d96c69a235fc
parent 10694
f46c1e224e8a
parent 10715
5e000d8fc96b
child 10814
ba20efe10336
equal deleted inserted replaced
10695:161fdb080c76 10733:d96c69a235fc
35 from PyQt6.QtGui import ( 35 from PyQt6.QtGui import (
36 QAction, 36 QAction,
37 QActionGroup, 37 QActionGroup,
38 QCursor, 38 QCursor,
39 QFont, 39 QFont,
40 QKeyEvent,
40 QPainter, 41 QPainter,
41 QPalette, 42 QPalette,
42 QPixmap, 43 QPixmap,
43 ) 44 )
44 from PyQt6.QtPrintSupport import ( 45 from PyQt6.QtPrintSupport import (
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:

eric ide

mercurial