Commit graph

462 commits

Author SHA1 Message Date
Marc Durdin
8abab53988 chore(core): Merge branch 'feat/core/10365-context-debug' into feat/core/9999-normalization-of-context
Note: shifted minor changes from action_api.cpp to new
state_context_api.cpp.
2024-01-16 06:16:45 +07:00
Marc Durdin
ba3290de75 chore(core): Merge branch 'master' into feat/core/10365-context-debug
Note: resolved merge conflict with action_api.cpp by shifting new code
into state_context_api.cpp.
2024-01-16 05:46:36 +07:00
Steven R. Loomis
c0928e1835
Merge branch 'master' into feat/core/10319-escaping-you-epic-ldml 2024-01-15 16:45:38 -06:00
Steven R. Loomis
ab67061843 feat(core): 32 bit escapades 🙀
- improved test code and marker parsing

#10319
2024-01-15 14:07:19 -06:00
Marc Durdin
84785fdd9a chore(core): wasm linker flags 2024-01-15 13:23:29 +07:00
Marc Durdin
932ad9d1df chore(core): add unit test deps for wasm 2024-01-15 12:50:41 +07:00
Marc Durdin
bd46fb271b feat(core): unit tests need to set both app context and cached context 2024-01-15 12:34:00 +07:00
Marc Durdin
036c32af1f feat(core): normalize input context
First half of #9999.

Adds support for normalization (to NFD) of input app context into the
cached context. The keyboard processor will work with the NFD cached
context.

Adds unit tests for the normalization as part of the LDML keyboard
processor test suite.

TODO:
* Comparing modified cached context to app context to determine the
  transform required to send to the app
* Handling illegal unicode and unpaired surrogates on input context
2024-01-15 11:50:16 +07:00
Marc Durdin
cd69405960 feat(core): add app_context and failing tests
Adds the application context member of state and a corresponding,
failing unit test, which starts the process of verifying the handling
of the application context.
2024-01-15 11:50:15 +07:00
Marc Durdin
9868de5abc
Merge branch 'master' into feat/core/10365-context-debug 2024-01-15 12:06:03 +11:00
Marc Durdin
bfb26eaf64 feat(core): adds km_core_state_context_debug
Fixes #10365.

Adds a `km_core_state_context_debug` function that returns a km_core_cp
string containing the current cached or intermediate context. The
function must be used only for debug logging purposes -- the string is
not intended to parsed for other purposes and the format may change in
the future.

This commit adds the function and corresponding unit tests. Subsequent
commits will update existing context debug functions in various engines
to use this API endpoint instead.
2024-01-15 07:19:31 +07:00
Steven R. Loomis
c5d0e0525e feat(developer): 32 bit escapades 🙀
- escaping working, matching not yet

#10319
2024-01-13 12:55:51 -06:00
Eberhard Beilharz
141b85814e
refactor(core): Move km_core_state_context_* tests to separate file
It was fairly surprising to have the unit tests for
`km_core_state_context_*` methods in `action_api.cpp`, so this change
moves them to a separate file.
2024-01-12 15:34:32 +01:00
Steven R. Loomis
e06cf99b02
Merge branch 'feat/core/10320-stack-markers-epic-ldml' into chore/core/10320-refactor-epic-ldml 2024-01-08 12:37:51 -06:00
Steven R. Loomis
776a902eb0 feat(core): stacked markers 🙀
- build fix for win

#10320
2024-01-06 13:56:37 -06:00
Steven R. Loomis
f38054f65a chore(core): split out some files 🙀
- markers/normalization really needs its own file
- split out ldml_markers.* from ldml_transforms.*
- split out ldml_utils.hpp for a common assert macro

#10320
2024-01-06 11:56:11 -06:00
Steven R. Loomis
b2b897970d feat(core): stacked markers 🙀
- renamed the single-segment functions to normalize_nfd_markers_segment() since they should only be run on a single segment
- commented out NFC for now, dead code
- add some additional checks/DebugLog around normalization

#10320
2024-01-06 11:33:51 -06:00
Steven R. Loomis
f4be7856da feat(core): stacked markers tests 🙀
- we can finally support single markers with the new structure
2024-01-06 10:17:10 -06:00
Steven R. Loomis
52fe9073a0 chore(core): stacked markers tests 🙀
- first we break

#10320
2024-01-05 18:52:43 -06:00
Steven R. Loomis
91b761b027 feat(core): fixup markers as regex 🙀
- move prepend_marker out of line
- replace bool for_regex with an enum
- cleanup another instance of \b -> \u0008

#9121
2024-01-02 17:21:04 -06:00
Steven R. Loomis
a6151e681b
Merge branch 'chore/core/ldml-test-robust-epic-ldml' into feat/developer/9121-reject-bad-regex-epic-ldml 2024-01-02 17:04:37 -06:00
Steven R. Loomis
84c218ff85
Merge branch 'feat/core/9121-more-regex-epic-ldml' into chore/core/ldml-test-robust-epic-ldml 2024-01-02 17:03:07 -06:00
Steven R. Loomis
0c3d1b513e
Merge branch 'feat/core/9468-stacked-markers-epic-ldml' into feat/core/9121-more-regex-epic-ldml 2024-01-02 17:03:00 -06:00
Steven R. Loomis
32ba632af9
Update core/tests/unit/ldml/test_transforms.cpp
Co-authored-by: Marc Durdin <marc@durdin.net>
2024-01-02 17:02:35 -06:00
Steven R. Loomis
02ba64d857 feat(core): fixup markers as regex 🙀
- needed to remove/re-add the “≈≈[\u0001-\uD7FE]” format  (aka LDML_MARKER_ANY_INDEX)

#9121
2023-12-30 21:09:42 -06:00
Steven R. Loomis
80ba5aa0ce fix(developer): escape markers as regex 🙀
- escape markers to prevent the n'th marker from having some other meaning
2023-12-30 11:18:51 -06:00
Steven R. Loomis
763f7abeb0 chore(core): failing test with markers 🙀
- marker overrun! the 40th marker becomes a parenthesis, breaking regex

feat(core): ldml proper regex implementation 🙀🙀 #9121
2023-12-28 18:57:33 -06:00
Steven R. Loomis
561cecb0de fix(core): fix ldml test runner loops 🙀
- more easily handle test events
2023-12-28 17:57:40 -06:00
Steven R. Loomis
ae96008c11 feat(core): ldml more regex tests 🙀
- match in a set
- quantifiers

For: #9121
2023-12-28 17:38:21 -06:00
Steven R. Loomis
ef2f8395b4 feat(core): better reporting in ldml tests 🙀
- more err reporting out of inner functions such as key not found
- helper functions for setting FAIL and SKIP actions with messages
- colorization

For: #9121
2023-12-28 17:38:21 -06:00
Steven R. Loomis
53201263d9 fix(core): use marker-safe normalization in between transform stages 🙀
- the intermediate stages of transforms also need to use marker-safe normalization
- re-enable a test that was failing previously due to this

For: #9468
2023-12-22 17:51:18 -06:00
Steven R. Loomis
9d1599d557 chore(core): add some more marker tests 🙀
- one disabled for now

For #9468
2023-12-21 11:36:35 -06:00
Steven R. Loomis
12aa9a5b69 chore(core): add some more marker tests 🙀
For #9468
2023-12-20 19:23:29 -06:00
Steven R. Loomis
0b3e7a94e8 chore(core): uncomment some more tests 🙀
For #9468
2023-12-20 18:50:21 -06:00
Steven R. Loomis
094f5ad492
Merge branch 'master' into feat/developer/9451-key-not-found-epic-ldml 2023-12-19 10:14:11 -06:00
rc-swag
1cb288144c chore(core): Merge branch 'master' into fix/core/clear-core-context-invalidate 2023-12-19 09:13:43 +10:00
rc-swag
deceabd5c3
fix(windows): review comments and suggestions
Co-authored-by: Eberhard Beilharz <ermshiperete@users.noreply.github.com>
2023-12-18 20:39:16 +10:00
rc-swag
2f737981f7 fix(core): add expected_context to keyboard unit tests
The unit tests needed to be updated to handle the cases
where the context is invalidated by a keystroke. However, they
still need to be able to verify the final string the application
should recieve. To do this a expected context token has been added
to the unit test format.
2023-12-15 11:20:08 +10:00
rc-swag
437f938368 fix(core): fix baseline test cases k_000 and k_0008
Test k_000___null_keyboard has been updated as the [RALT K_B] should
cause the context to be reset.

Test k_008___vkey_input__ctrl_alt_2_ has been updated as the [LCTRL LALT
K_B] does not match a keyboard rule the context is deemed invalid and should be
reset.

It could be a consideration to modify the text_store object to better
reflect the state of a applications context however this would mean
we would need two expected results one for the application and one
for the context
2023-12-14 12:25:32 +10:00
Steven R. Loomis
0d3458deef chore(core): comments in key-not-found 🙀
- typo fix
- clarify default behavior for missing keys

For: #9451
2023-12-12 18:43:00 -06:00
Steven R. Loomis
26048702d2
Merge pull request #10090 from keymanapp/fix/core/9451-key-not-found-epic-ldml
feat(core): ldml improve key-not-found 🙀
2023-12-12 16:19:53 -06:00
rc-swag
4a511bde1e fix(core): clear core context on invalidate cache 2023-12-12 23:49:04 +10:00
Steven R. Loomis
1e32a2a963 feat(core): ldml improve key-not-found 🙀
- copy exception table for reset from VKScanCodes.cpp
- update test

For: #9451
2023-12-07 17:15:44 -06:00
Steven R. Loomis
3c95c85b7c
Merge branch 'master' into fix/core/9451-key-not-found-epic-ldml 2023-12-07 14:00:59 -06:00
Steven R. Loomis
392c535270 feat(core): ldml improve key-not-found 🙀
- also affects markers, feat(core): normalization per spec for transforms/etc 🙀  #9468
- keep markers in nfd context string
- fix ldml test harness to handle context reset
- update test case
- still issues with overproduction of markers in the context

For: #9451
2023-12-06 18:33:51 -06:00
Marc Durdin
802f22578a chore(core): address review comments 2023-12-04 13:37:59 +07:00
Marc Durdin
b6daac0bdb feat(core): action struct to action items conversion
Adds state->set_actions(). This sets the Core's action list to match the
contents of the action struct. Note that markers are not supported and
backspace expected_values will be empty, as this information is not
available. As the intended consumer of the action struct does not need
to know this information, this should be adequate.
2023-12-01 12:27:49 +07:00
rc-swag
6820f36f7d fix(core): set_if_needed updates a empty cached context
In the case when the cached context had been cleared the
km_core_state_context_set_if_needed call would just compare
the null terminations of both strings and not set the cached
context to the application context.
2023-11-30 13:09:22 +10:00
Steven R. Loomis
11334ed7fa feat(core): ldml improve key-not-found 🙀
- distinguish between unmapped and 0-length output strings
- don't do any processing for 0-length output strings
- no change to developer, that will be next
- remove a comment referencing transform=no

For: #9451
2023-11-28 18:07:46 -06:00
Marc Durdin
7ec4832edc fix(core): memory management of options in action struct
Fixes #10067.

Management of memory for persisted options was wrong in the action
struct, as the members key and value would be freed immediately after
being added to the temporary vector (because the vector was of the
struct rather than of the class).

Given the struct is a C struct, we need the memory management to be
explicit, so we now release() each option into the vector as we create
it, which means that its member values will not be freed when the option
is then immediately deleted. (This allows us to use the initial copy of
the members of option that option() constructor does.)

Added the release() function as that was a relatively clear way of
indicating that the contents of the structure are now owned by the
caller, following the pattern from std::unique_ptr.

Finally, the unit test for persisted options was in the action_api.cpp
test module, but it was never called, so this was not being tested. Now
it is.
2023-11-24 07:52:31 +10:00