A simple mobile keyboard that uses variable stores gets bad values in those stores if a lexical model is present. This happens both on the Android (e.g. in Keyman app or in a KAB app) or in a browser window (simulating a mobile device) testing the keyboard and lexical model.
The KMN file contains this (after the system stores):
store (myVar) "1"
begin Unicode > use(main)
group(main) using keys
+ [K_S] > "(+)" set(myVar="1") c S will Set the variable, and output (+)
+ [K_C] > "(-)" set(myVar="0") c C will Clear the variable, and output (-)
if (myVar = "1") + [K_R] > "+" c R will Reveal the variable's state with + or -
if (myVar!= "1") + [K_R] > "-"
A touch layout provides buttons to send K_S, K_C, and K_R.
Let’s suppose you type: SRRRRCRRRR
Without a lexical model present, you get the expected output:
(+)++++(-)----
But if a lexical model is present, even the starting model with no changes, the output is this:
(+)-+++(-)++++
That is, after setting the variable, the first reveal shows that it’s cleared, and thereafter shows that it’s set. And after clearing the variable, it always shows that it’s set.
I need to be able to take advantage of variable stores in my keyboard, but I don’t want to lose the predictive text. Any help in this matter would be greatly appreciated. Thank you!