keyman icon indicating copy to clipboard operation
keyman copied to clipboard

bug(developer): `[NCAPS SHIFT_K_P]` seemed to compile but is invalid

Open mcdurdin opened this issue 1 year ago • 1 comments

store(nul) [NCAPS K_B] [NCAPS SHIFT K_B] [NCAPS K_F] [NCAPS SHIFT K_F] [NCAPS K_P] \
           [NCAPS SHIFT_K_P] [NCAPS K_R] [NCAPS SHIFT K_R] [NCAPS K_Z] [NCAPS SHIFT K_Z]
+ any(nul) > nul

How did this ([NCAPS SHIFT_K_P]) compile previously?!

Originally posted by @mcdurdin in https://github.com/keymanapp/keyboards/pull/3056#discussion_r1735461725

@MarkCSinclair one for a unit test?

mcdurdin avatar Aug 29 '24 01:08 mcdurdin

It would appear the compiler does not require spaces between the modifiers, or between the modifiers and the key portion, so [CTRLK_A] compiles as if [CTRL K_A], [CTRLALT K_A] as if [CTRL ALT K_A] and [NCAPS SHIFT_K_P] as if [NCAPS SHIFT _K_P] (so this will be a custom key name i.e. _K_P, not key K_P`)

markcsinclair avatar Oct 14 '24 15:10 markcsinclair

In addition, there is a space problem with grouping multiple virtual keys. The compiler sees [K_A K_B K_C] as K_A followed by K_ followed by K_.

markcsinclair avatar Oct 29 '24 14:10 markcsinclair

Support for series of virtual keys (e.g. [K_A K_B K_C]) is not documented and not supported by us. We should just block them in the compiler, as there is no good use case for them. (This was developed long-ago in anticipation of a possible feature for emitting virtual keys, but emitting virtual keys has been explicitly not supported for many years now.)

mcdurdin avatar Oct 31 '24 02:10 mcdurdin