Variable store problems can hinge on KAB settings

I don’t know whether this is a Keyman problem or a KAB problem, and I don’t know how to determine which it is:

Sometimes, a keyboard loses track of its variables. I naturally assumed that the contents of my KMN file were the problem, but it seems random whether the problem will occur in a given build. Sometimes I’ll make an insignificant change in the code (e.g. change the order of two mutually-exclusive rules), OR I’ll make a change in the KAB app settings, such as package ID, and that alone will be enough to change whether or not it works.

In the simplest case, the keyboard contains this debug code to set, clear, and show the value of the smartQuotes variable: (The touch keyboard has buttons for T_SET, T_CLEAR, and T_SHOW.)

store (smartQuotes) "1"

begin Unicode > use(main)

group(main) using keys

+ [T_SET] > "(+)" set(smartQuotes="1")
+ [T_CLEAR] > "(-)" set(smartQuotes="0")
if(smartQuotes!='1') + [T_SHOW] > "-"
if(smartQuotes ='1') + [T_SHOW] > "+"

I’d expect that after pressing T_SET (which produces “(+)”), subsequent presses of T_SHOW would produce plus signs, and likewise, after pressing T_CLEAR (which produces “(-)”), subsequent presses of T_SHOW would produce minus signs.

Running it in the simulator, pressing T_SET T_SHOW T_SHOW T_SHOW T_SHOW T_CLEAR T_SHOW T_SHOW T_SHOW , you see the expected output: (+)++++(-)----

However, a KAB app unpredictably either does that, or outputs: (+)-+++(-)++++

Where do I even begin troubleshooting this?

OK, I have some new clues as to what is happening:

  1. The problem with using variable stores occurs when a lexical package is present. (Perhaps some kind of memory overflow?)
  2. The lexical package is still present on the device even after it’s removed from the KAB app. (Changing the app’s package ID or the keyboard’s language code can get the app to ignore the residual model.)

But whether this is a KAB issue or Keyman issue, how can I determine this?

OK, this happens quite apart from KAB in the Keyman app. It seems that any keyboard that uses variable stores will not work with any lexical model present. I’ll report this as a Keyman bug.

1 Like

See Lexical models break variable stores (At least for mobile keyboards)