Commit graph

1157 commits

Author SHA1 Message Date
Eberhard Beilharz
3816077d0a
Merge pull request #15609 from keymanapp/fix/core/15569_ldml
fix(core): fix keydown/up handling for LDML keyboards

For LDML keyboards this change fixes the `emit_keystroke` flag so that it always has the same value for the KeyDown and the KeyUp event. This fixes some problems with stuck keys. Previously we would set `emit_keystroke=TRUE` on KeyDown but `emit_keystroke=FALSE` on KeyUp for frame keys. This caused Linux to never see the KeyUp event, resulting in a stuck key.

Also add unit tests that verifies that the actions that we get after calling `km_core_process_event` are what we expect.

Follows: #15656 
Fixes: #15569
Fixes: #15550
2026-03-25 11:20:11 +01:00
Eberhard Beilharz
aa36cfe961
fix(core): address code review comments
Some checks failed
Keyman Build Summary / Summarize build status checks (push) Has been cancelled
2026-03-24 12:43:11 +01:00
Eberhard Beilharz
1c5dbe8caf
docs(core): improve keyhandling doc
This improves the keyhandling doc according to the code review suggestions
in #15629.

Follows: #15629
Build-bot: skip
Test-bot: skip
2026-03-12 18:15:09 +01:00
Eberhard Beilharz
87da33796a
Merge pull request #15656 from keymanapp/refactor/core/cleanup
refactor(core): cleanup 

- fix whitespace
- rename private fields of `ldml_processor` to start with underscore

Precedes: #15609
2026-03-04 15:27:47 +01:00
Eberhard Beilharz
9836070299
fix(core): clarify and extend comment 2026-03-02 17:43:34 +01:00
Eberhard Beilharz
67468c4dce
fix(core): address code review comments
Co-authored-by: Marc Durdin <marc@durdin.net>
2026-03-02 17:28:19 +01:00
Eberhard Beilharz
382b5d45e3
fix(core): fix keydown/up handling for LDML keyboards
For LDML keyboards this change fixes the `emit_key` flag so that it has
the same value for the KeyDown and the KeyUp event. This fixes some
problems with stuck keys. Previously we would set `emit_key=TRUE` on
KeyDown but `emit_key=FALSE` on KeyUp for frame keys. This caused Linux
to never see the KeyUp event, resulting in a stuck key.

Also add unit tests that verifies that the actions that we get after
calling `km_core_process_event` are what we expect.

Fixes: #15569
Fixes: #15550
2026-03-02 17:27:36 +01:00
Eberhard Beilharz
2bd6cfd735
refactor(core): rename fields to start with underscore
Test-bot: skip
2026-03-02 17:27:15 +01:00
Eberhard Beilharz
d8a5f694da
refactor(core): fix whitespace
Build-bot: skip
Test-bot: skip
2026-03-02 17:26:14 +01:00
Eberhard Beilharz
f07f95452f
docs(core): add keyhandling doc
This documents the state of `km_core_actions.emit_keystroke` for
different keys pressed. Also some cleanup in other docs.

This documents the state after merging #15609 (for ldml keyboards) and
NN (for kmn keyboards).

Follows: #15609
Build-bot: skip
Test-bot: skip
2026-02-25 19:31:00 +01:00
Eberhard Beilharz
2237db95f6
test(core): add LDML baseline test with minimal keyboard
This replaces and enables the commented `k_000_null_keyboard` test which
didn't work because keys that are not on any layer don't produce output.
This instead defines a minimal keyboard with just two keys and then tests
typing a key that is on the keyboard followed by a key not on the keyboard.

Test-bot: skip
2026-02-20 12:09:08 +01:00
Eberhard Beilharz
b405bf5842
refactor(core): simplify loop for removing text
Instead of using an iterator to loop over the context items, incrementing
a counter on each iteration, and then finally removing the calculated
number of context items from the list, this change loops through the list
and looks at the last context item, removing it if necessary.

Follows: #15596
Test-bot: skip
2026-02-18 17:34:02 +01:00
Eberhard Beilharz
df2b675202
fix(core): changed ldml tests to use context list instead of vector
Production code uses a list of context items, so this change modifies
the tests to also use a list instead of a vector to more closely match
production code.

Addresses code review comment.

Test-bot: skip
2026-02-18 16:08:59 +01:00
Eberhard Beilharz
32bb1c8502
fix(core): fix iterator in backspace handling
This change replaces the reverse iterator loop that holds a stale iterator
across `pop_back()` calls with a pattern that directly accesses
`context.back()` on each iteration. This avoids undefined behavior from
iterator invalidation when mutating the list or vector.

While so far the previous code didn't show problems, it might still access
released memory depending on the implementation. The documentation for
`pop_back()` says "References and iterators to the erased element are
invalidated", so the previous implementation was clearly wrong.

Test-bot: skip
2026-02-18 15:58:45 +01:00
Marc Durdin
74d1bc8fc2 chore(core): address review comments
Co-authored-by: Darcy Wong <darcy_wong@sil.org>
Co-authored-by: Eberhard Beilharz <ermshiperete@users.noreply.github.com>
2026-02-01 06:47:49 +11:00
Marc Durdin
766c6992ed fix(core): normalization segment should end on NFC boundary, not NFD
When normalizing, we need to stop processing on an NFC boundary, not an
NFD boundary, to support normalizations such as in Bengali, where
appending `U+09D7` to a context of `U+0995 U+09C7` should result in
`U+0995 U+09CC`.

The specification is unclear on this; see https://unicode-org.atlassian.net/browse/CLDR-19218

This also updates the ldml keyboard unit test suite to support running
in full NFC mode (used in all Engine implementations) as well retaining
the NFD mode (now only used by the debugger).

Side note: the Bengali normalization failure case was picked up by the
improvements to the unit test suite, proving once again that good tests
are so valuable.

Fixes: #15491
Fixes: #15505
Follows: #15488
Relates-to: CLDR-19218
2026-01-28 14:32:25 +11:00
Marc Durdin
033e3eeb3f docs(core): add comments post review
Co-authored-by: srl295@gmail.com
2026-01-27 10:50:26 +11:00
Marc Durdin
f7cd0c41ba fix(core): handle backspace decomposition
Ensure that when a single backspace decomposes the last NFC character in
the app context, the remainder of the 'cluster' is preserved, matching
the implication of the CLDR keyboard specification.

This addresses the behavior in #15487 where the cached context became
out of sync with the app context after deleting an entire NFC cluster
such as ê, which caused a loop ending up with the entire context being
deleted, at which point the loop exited with a fail-safe.

Note that the LDML keyboard tests (ldml.cpp) do not currently exercise
the normalization code; this is a gap that should be addressed to ensure
that we are testing final application behavior.

Fixes: #15487
2026-01-25 07:24:15 +11:00
Marc Durdin
484acff8e8
Merge pull request #15353 from keymanapp/maint/win/15065-arm64-core-test
maint(windows): add GitHub Action for ARM64 test for Keyman Core 🦾
2025-12-16 18:49:57 +01:00
Marc Durdin
3048705c9b maint(windows): add GitHub Action for ARM64 test for Keyman Core
Add a GitHub action to test Keyman Core on Windows / ARM64. We do not
have a TeamCity ARM64 agent for this. There are a number of config
challenges in making this work as many deps do not yet support ARM64;
however the changes are isolated to the .yml.

Test-bot: skip
2025-12-16 06:48:25 +11:00
rc-swag
4ac24f7b7b chore(windows): Merge branch 'epic/win-arm' into feat/windows/64x-pure-forwarder-wix-3 2025-12-09 14:00:45 +10:00
Marc Durdin
d7f21e80ec chore: Merge remote-tracking branch 'origin/epic/win-arm' into auto/A19S17-merge-master-into-win-arm
Significant conflict resolution fixes required to:
*	windows/src/engine/keyman32/build.sh
*	windows/src/engine/keyman32/keyman-engine.vcxproj
*	windows/src/engine/keyman32/keyman32.vcxproj
*	windows/src/engine/keyman32/keyman32.vcxproj.filters
*	windows/src/engine/keyman32/tests/keyman32.tests.vcxproj
2025-12-05 10:16:37 +01:00
rc-swag
192a94e6c5 feat(windows): simplify vc config environment
With VS2022 the limitations for the -hostarch flag not being available
on arm environment and the -arch only having x86 and x64 has been
removed. There is now single command that works for 3 builds on either
host architecture.
Fixes: 15239
Test-bot: skip
2025-12-02 16:07:04 +10:00
Marc Durdin
9335a82530 maint(core): verify that keyman_core_ldml.h is in sync
Fixes: #15254
Test-bot: skip
Build-bot: skip build:linux,mac,windows
2025-12-01 17:11:57 +01:00
rc-swag
ad34a44c9f chore(windows): Merge branch 'epic/win-arm' into feat/windows/11905/keymanx64-keymanarm64 2025-11-21 18:36:13 +10:00
rc-swag
c9753f6ba2 feat(windows): handle arch type in build.bat skip build.sh
Add a host check for build.bat and run the architecture tests
that match the host. for the meson builds from build.h
for now just skip the arm64 tests.
2025-11-19 11:50:57 +10:00
Eberhard Beilharz
2d8a4aeebc
maint(core): fix option defaults for Meson >= 1.1
Meson 1.1 changed the name of the options file from `meson_options.txt`
to `meson.options`. Currently we're stuck with Meson 1.0 as minimum
Meson version because we still support Ubuntu 22.04 Jammy, but on some
machines a newer version of meson gets installed which causes the
options to be ignored.

The first attempt to simply symlink or copy `meson_options.txt` to
`meson.options` failed because git on Windows doesn't support symlinks
by default, and Meson complains if it finds two options files (#15127).

Fortunately not having an options file is only a problem for Core where
we have one option in the options file that defaults to true. The solution
implemented in this change is to always pass the option to Meson.

Test-bot: skip
2025-11-10 15:24:46 +01:00
rc-swag
1cf430bb98 chore(windows): Merge branch 'epic/win-arm' into feat/windows/11905/keymanx64-keymanarm64 2025-11-10 11:29:40 +10:00
Marc Durdin
df212364a2 maint(resources): add repository record for all published packages
While not documented as such, it appears that the repository record is
required with trusted publishing of npm packages.

Test-bot: skip
Build-bot: skip
2025-10-29 14:35:31 +01:00
rc-swag
2f2df0bb8f feat(windows): fix typos entered into the build.bat 2025-10-28 17:08:47 +10:00
Marc Durdin
fe6e8e72a8
Merge pull request #15029 from keymanapp/maint/resources/14963-npm-publish-on-gha
maint(resources): move npm package publishing to GitHub Actions
2025-10-28 07:57:35 +01:00
rc-swag
d52b48cbbb feat(windows): handle arm64 complier environment
Update the build.bat to handle configuring the build
environment with vsdevcmd correctly for arm64 2019 doesn't
work very well so have to have pretty weird if statement.
also checked in some missed updates to function name change
2025-10-28 16:40:42 +10:00
Marc Durdin
ba411774f6 maint(resources): move NPM package publishing to GitHub Actions
Due to recent changes in NPM package publishing security requirements,
we have to move from TeamCity build to a GitHub Action to publish our
NPM packages, so we can take advantage of trusted publishing. This
change also consolidates and centralizes the npm publishing into
resources/build/ci/npm-publish.sh, which removes a lot of boilerplate
from each of the build.sh scripts, and ensures consistency.

Packages will be `npm pack`ed on PR and test builds, and published in
release builds.

Ref: https://docs.npmjs.com/trusted-publishers
Ref: https://github.blog/changelog/2025-09-29-strengthening-npm-security-important-changes-to-authentication-and-token-management/
Fixes: #14963
Test-bot: skip
Build-bot: release:developer
2025-10-27 16:31:55 +01:00
Marc Durdin
55d6efe482 fix(developer): prevent ANSI keyboards crashing debugger
Note: #11909 has some additional future cleanup we could do, but these
code paths are not currently accessible, so in the interest of moving
forward, am leaving them for now.

Fixes: #11909
Test-bot: skip
2025-10-24 14:45:17 +02:00
rc-swag
5f974775cd feat(windows): remove echo 2025-10-22 22:48:27 +10:00
rc-swag
1340c4f9e5 feat(windows): add arm64 to wxs and core build
Add cross-arm64 and cross-x64 build
Add the arm64 binaries to the wxs installers with guids
update build.sh files
2025-10-14 16:00:40 +10:00
rc-swag
5ac167977b Merge branch 'epic/win-arm' into feat/windows/11905/keymanx64-keymanarm64 2025-10-01 14:11:23 +10:00
Marc Durdin
f3fb3ac87b maint(common): move build-utils-ci.inc.sh to ci/ci-publish.inc.sh
Removes a number of unused functions from the file, renames remaining
functions to match our builder script prefix patterns, removes unused
imports from various build scripts (e.g. Android).

Fixes: #14453
2025-08-05 12:54:56 +10:00
Marc Durdin
2726050601 maint(common): rename and move node-related script functions into node.inc.sh
Consolidates the node-related script functions into node.inc.sh, as part
of cleaning up the build scripts and making them easier to maintain into
the future.

Fixes: #14447
2025-08-02 13:34:29 +10:00
Marc Durdin
f394245636 maint(common): consolidate builder scripts
Clarifies the confusing builder.inc.sh / build-utils.sh distinction by
giving the scripts more appropriate names. Most build scripts should use
builder-full.inc.sh; some helper scripts can use builder-basic.inc.sh.
Documented in resources/build/README.md.

Renames:
* resources/build/builder.inc.sh to resources/build/builder-full.inc.sh
* resources/build/build-utils.sh to resources/build/builder-basic.inc.sh

Other changes:
* Moves Android-specific functions out of builder-basic.inc.sh and into
  android/build.sh.
* Renames functions in builder-basic.inc.sh

More functions may be moved from builder-basic.inc.sh into utils.inc.sh
or other scripts in the future.

Fixes: #14065
Build-bot: build all
Test-bot: skip
2025-08-02 08:11:24 +10:00
Marc Durdin
65158a0526 maint(common): rename shellHelperFunctions.sh to utils.inc.sh
Adds documentation for various functions, removes unused functions (a
couple of simple, very lightly used functions were unDRYed; these could
go back the other way across all shell scripts if necessary). TODO items
noted for follow-up refactoring.

Fixes: #14275
Relates-to: #14269
Build-bot: build all
Test-bot: skip
2025-08-02 06:58:40 +10:00
Marc Durdin
808b6557d6 maint(common): use cpp_std=c++17 in meson project default_options
We attempted to set the C++ version in standard.meson.build, but this
does not work well as the option name varies by platform, and it also
triggers a warning in meson. This fix moves the setting into each
meson.build project() default_options. As there are only a handful
of these, the maintenance burden is not high.

Fixes: #14432
Relates-to: #14355
Build-bot: build
Test-bot: skip
2025-08-01 10:23:57 +10:00
rc-swag
99d9d68e66 Initial addition of arm64 configuration 2025-07-31 16:30:23 +10:00
Eberhard Beilharz
51ca604b47
chore(common): Merge remote-tracking branch 'origin/master' into maint/common/14109_isOsFuncs 2025-07-21 09:20:12 +02:00
Eberhard Beilharz
faa521d82c
maint(common): set C++17 in standard.meson.build
Note that the ICU subprojects still explicitly specify C++17 since they
are maintained outside of Keyman and so shouldn't be tied to the Keyman
compiler version requirement.

Fixes: #12526
Test-bot: skip
2025-07-18 14:04:11 +02:00
Eberhard Beilharz
acebacc2b6
maint(core): explain (wrong) meson warning
Build-bot: skip
Test-bot: skip
2025-07-17 17:03:47 +02:00
Eberhard Beilharz
3b136fcec9
maint(common): consolidate functions to determine OS
- add `builder_is_windows`, `builder_is_macos` and `builder_is_linux`
  functions
- add/move `BUILDER_OS` env variable to `resources/builder.inc.sh`
- use the new functions and env variable

Fixes: #14109
Test-bot: skip
2025-07-09 18:33:09 +02:00
Steven R. Loomis
4d9551ae07
Merge pull request #14050 from keymanapp/feat/developer/13939-ln-layrcompiler
feat(developer): line numbers for layr compiler
2025-05-27 19:00:41 -05:00
Steven R. Loomis
b681885eca feat(developer): add more tests to layr compiler
- check for duplicate minDeviceWidth
- check for invalid minDeviceWidth

Fixes #13939
2025-05-26 12:30:59 -05:00
Marc Durdin
9f15e7c7ec maint: add empty 'scripts' tag to package.json to silence warning
Also removes './' from front of gosh.js to address another npm cleanup
(from `npm pkg fix`).

Fixes: #13833
2025-05-25 06:35:28 +07:00