-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug(developer): context(n)
counts the nul
statement as a character in Web & android
#13276
Comments
Thank you for this clear and detailed report. I have managed to reproduce this issue with Keyman Developer 18.0.190-beta (will be same as .193) and have built a minimal reproduction with the following keyboard. To reproduce the problem, type es: On kmx-based platforms, this produces '12b3'.
The web compiler produces the following function for the this.g_post_1=function(t,e) {
var k=KeymanWeb,r=1,m=0;
if(k.KN(2,t)&&k.KCM(2,t,"a",1)&&k.KA(1,k.KC(1,1,t),this.s_cons_4)){
m=1; // Line 15
k.KO(2,t,"12");
k.KO(-1,t,"a3");
}
return r;
}; KMX compiler produces the following for that rule:
We can see how the compiler has selected "a" as the character to output, rather than referencing the input character from the k.KO(-1,t,"a3"); This is definitely not consistent between the platforms. Unfortunately, the documentation for Generally, in this situation, we select the .kmx behaviour to be the intended behaviour. We'll update the documentation accordingly. This behaviour looks to have been in place since 2003 for .kmx: keyman/core/src/kmx/kmx_processevent.cpp Lines 340 to 344 in 0958a2d
I need to do some more investigation on the history of this discrepancy:
|
This is a longstanding bug. I tested with 15.0.274 and got the same results.
The problem is not impacted by #13003, although I am surprised that I didn't pick this up when I was addressing that bug.
regex search: No published keyboards in the repository impacted by this bug. No test keyboards in this repository that test this bug. So it looks novel and we should be able to address this without significant ramifications. |
context(n)
counts the nul
statement as a character in Web & android
The
Note that usage of
This suggests that perhaps it would be better to bring |
I've completed some further analysis on this bug and it reinforces my previous comment -- it would be better to move towards implementing a fix in Keyman Core for this specific case of We have the following possible cases with This is the test keyboard in question:
any > context(1)
if(k.KA(0,k.KC(1,1,t),this.s_cons_4)){
r=m=1; // Line 12
k.KO(1,t,"1");
k.KIO(-1,this.s_cons_4,1,t);
} nul any > context(2)
With v9 kmw compiler mode ( if(k.KN(1,t)&&k.KA(0,k.KC(1,1,t),this.s_cons_4)){
r=m=1; // Line 13
k.KO(1,t,"2");
k.KIO(-1,this.s_cons_4,1,t);
} Note how With v10 kmw compiler mode ( if(k.KFCM(2,t,[{t:'n'},{t:'a',a:this.s_cons_5}])){
r=m=1; // Line 14
k.KDC(1,t);
k.KO(-1,t,"2");
k.KIO(-1,this.s_cons_5,1,t);
} Note: line number and store number differences are not relevant (due to additional Note that char any > context(2)
if(k.KCM(2,t,"x",1)&&k.KA(1,k.KC(1,1,t),this.s_cons_4)){
r=m=1; // Line 14
k.KO(2,t,"3");
k.KIO(-1,this.s_cons_4,2,t);
} Note how if any > context(2)
if(this.s_ifx_5===this.s8&&k.KA(0,k.KC(1,1,t),this.s_cons_4)){
r=m=1; // Line 15
k.KO(1,t,"4");
k.KIO(-1,this.s_cons_4,1,t);
} Note how SummaryIf we move away from
ResolutionSee: Workarounds
|
I use an arabic phonetic keyboard that I made on my own, It is documented here.
I am making a mobile version of it and I'm facing an issue/bug:
At this line:
context(n)
statement in the output probably handled the nul statement in the input as a character/countable block)On the other hand, at this line:
nul
wasn't counted for some reason)This could be another issue/bug where
any()
statements aren't saved to get called back with thecontext(n)
statementThis bug is consistent in all other rules, like this one for example:
context(n)
statements when outputting)I genuinely can't find an explanation or a fix for these issues, please find a fix for them or give me the solution that's already been found :)
Related issues
#12987
& maybe:
#13040
Keyman apps
Keyman version
tested on V17.0 & V18.0.193
Language name
Arabic (my own custom keyboard)
Additional context
The behaviour is normal when debugging in keyman developer
The text was updated successfully, but these errors were encountered: