Skip to content
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(core): nul, any, and index() have an off-by-one error in Keyman Core #13316

Open
mcdurdin opened this issue Feb 21, 2025 · 0 comments · May be fixed by #13314
Open

bug(core): nul, any, and index() have an off-by-one error in Keyman Core #13316

mcdurdin opened this issue Feb 21, 2025 · 0 comments · May be fixed by #13314
Assignees
Labels
bug core/ Keyman Core
Milestone

Comments

@mcdurdin
Copy link
Member

mcdurdin commented Feb 21, 2025

store(&version) '10.0'
store(&TARGETS) 'any'

begin Unicode > use(main)

store(cons) 'mnpqrstv'

group(main) using keys

nul any(cons) + 'e' > '5' index(cons,2)

With this keyboard in Keyman Core 15.0 or later (e.g. debugger, Keyman for Windows), try typing: te

  • The output should be 5t.
  • For Keyman Core, the output is 5m

This issue is present in Keyman Core 15.0 and later versions. I have not tested earlier versions.

Note that using index(cons,1) gives a compiler error which makes total sense:

test_13276.kmn (20): Error: 4032 An index() in the output does not have a corresponding any() statement

I have tested the same pattern with if() and it works correctly in Keyman Core.

@mcdurdin mcdurdin changed the title For Keyman Core, the output is 5m bug(common): nul, any, and index() have an off-by-one error in Keyman Core Feb 21, 2025
@mcdurdin mcdurdin changed the title bug(common): nul, any, and index() have an off-by-one error in Keyman Core bug(core): nul, any, and index() have an off-by-one error in Keyman Core Feb 21, 2025
@keymanapp-test-bot keymanapp-test-bot bot added core/ Keyman Core and removed common/ labels Feb 21, 2025
mcdurdin added a commit that referenced this issue Feb 21, 2025
Two separate bugs addressed, with `index()` references and with
`context()` references -- both have the same root cause, of not taking
`nul` at the start of the context into account (as `nul` is not included
in the `m_miniContext` member, being a non-character). We already fixed
this issue for `if()` quite a long time ago, and some of the same
patterns can be with `m_miniContextIfLen` for example.

Fixes: #13304
Fixes: #13316
@mcdurdin mcdurdin self-assigned this Feb 21, 2025
@mcdurdin mcdurdin added this to the B18S2 milestone Feb 21, 2025
@mcdurdin mcdurdin moved this to In Progress in Keyman Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug core/ Keyman Core
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

1 participant