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?