I find that we have used SCK_ADD, SCK_SUBTRACTand SCK_DIVIDE in mac short key, however, none of add key, substract key nor divide key are converted to these SCK_ values. As a result, none of them works.
This patch convert translate these macOS key codes to Scintilla's
I find that we have used
SCK_ADD,SCK_SUBTRACTandSCK_DIVIDEin mac shortcut map, however, none of add key, substract key nor divide key are converted to theseSCK_values. As a result, none of them works.This patch converts translate these macOS key codes to Scintilla's
changelog: fix English mistakes
P.S. seems that I can edit a comment but not the ticket itself.
Last edit: Tse Kit Yam 2016-09-27
SCK_ADD, SCK_SUBTRACT and SCK_DIVIDE refer to the keypad keys. They are based on Win32's VK_ADD, VK_SUBTRACT, and VK_DIVIDE. The patch appears to be for the ASCII '+', '-' and '/' and won't match keypad keys.
http://www.kbdedit.com/manual/low_level_vk_list.html
No matter we are press the
+next to the delete key or the+on the numpad, both returns+in[input characterAtIndex: i]. So we can't use the character to identify which+key is pressed.If we want to identifier which
+key is down, we have to use anotherNSEventproperty namedkeyCode, which returns virtual key code value,kEventParamKeyCode, assoicated to the key down event. These values are defined in Carbon framework. e.g. the+key on numpad returnkVK_ANSI_KeypadPlusand the+key next to delete key returnskVK_ANSI_Equal(because it is a=key basically).As a reusIt, I want to modify
bool ScintillaCocoa::KeyboardInput(NSEvent* event), such that it will translatekeyCodeto constants used by sintilla, instead of characterscharactersIgnoringModifiers. The down side is that we have to translate all thekeyCodeto ASCII, or scintila key code value.Any comment?
Last edit: Tse Kit Yam 2016-09-28
By the way, there is a easier way,
static inline UniChar KeyTranslate(UniChar unicodeChar)not only need aUnichar, and also thekEventParamKeyCodefrom[event keyCode]. Then we can have somthing likeLast edit: Tse Kit Yam 2016-09-28
With Cocoa there is a NSNumericPadKeyMask that should be included in modifierFlags.
I don't know defining a new modifier flags for the numpad mask is a good idea or not, so I added
NSEventModifierFlagstoKeyTranslateas an additional parameter instead.That behaves OK for me. Are they all the keys you want to handle this way?
Yes, there should be not other keys need such handling.
Committed fix as [3e90b7].
Related
Commit: [3e90b7]