Open nosami opened 4 years ago
The auto-repeat event for those keys does reach the KeyDown
handler, and I am passing it to InterpretKeyEvents
as Apple documents, but this method in turn never calls the InsertText
for those characters.
The text system in macOS does not repeat keys by default, at least when the responder conforms to NSTextInputClient
. This can be controlled via the ApplePressAndHoldEnabled
default. You should be able to set this default to false for the bundle in the app delegate (probably in applicationWillFinishLaunching
).
You can see the behavior change by disabling/enabling the default globally and [re]launching TextEdit.app. When enabled, keys will not repeat. When disabled they will repeat.
defaults write -g ApplePressAndHoldEnabled -bool false
IIRC, Apple turned off key repeating by default to facilitate the popover UI for selecting diacritical marks. For example, long press e
and press 2
and é
will be inserted via InsertText
. That is, disabling ApplePressAndHoldEnabled
effectively disables the diacritical mark input method.
E.g.
i
&n
repeat,j
&k
don't