keymanapp / keyman

Keyman cross platform input methods system running on Android, iOS, Linux, macOS, Windows and mobile and desktop web
https://keyman.com/
Other
393 stars 109 forks source link

bug(developer): use and match #5440

Closed mcdurdin closed 3 years ago

mcdurdin commented 3 years ago

If a keyboard contains rules such as:

group(Main) using keys

+ [K_1] > 'a'
'b' + [K_2] > context use(b)

match > use(a)

group(a)

'a' > 'b'
'abc' > 'foo'

group(b)

'b' > 'abc'

Typing 12 will not result in foo but rather in abc, because poststring explicitly short-circuits calling match if a use is found in the output of the matched rule.

This is long-standing behaviour so we can't change it, but it needs to be documented.

A good solution for the future is for match(all) to be defined to give more logical semantics of firing no matter what the output of the rule is (parallel to nomatch(all) but note that the meaning of "all" is subtly different -- so consider naming options here).

NOTE: When this issue was originally opened, it related only to documenting this issue. However, we uncovered a discrepancy between web and desktop: web would call match after a use(), which is now also tracked here.

mcdurdin commented 3 years ago

Need to review for web that this behaviour matches

mcdurdin commented 3 years ago

NOTE: this behaviour does not match for web. This is divergent and should be fixed...

mcdurdin commented 3 years ago

I have audited the keyboards in the repository and there is one keyboard that would be impacted by a fix (probably positively): lao_phonetic. I propose that we rebuild this keyboard with the updated compiler, once verifying that the Windows-behavior is as expected, so that the web behavior matches.

We will need to document this fix as a breaking (albeit positive) change in the compiler.