This comes out of a design philosophy review on what we include when we
embed OSK data into KMX.
We will now avoid embedding font name into the OSK (and hence .kmx)
altogether, and leave that metadata to the packaging data. Reasons:
1. The font information is specified in the .kps, so we have to do a
patchup on the .kmx during packaging if we want to embed the info
into the OSK.
2. The referenced font must be supplied separately anyway (via .kmp,
@font-face, or system supplied, etc), so including the font facename
in the keyboard is not really all that helpful.
3. Philosophically, the font is really a presentation level factor
(aside from displaymap considerations). Keeping it together with
future theming and styling choices, rather than the key layout data,
seems appropriate.
4. This makes fewer places where font data is referenced -- in fact, to
just one place: in the .kps/.kmp for LDML keyboards, which is great.
This also simplifies some aspects of the embed-osk-in-kmx work, removing
the need to patch the .kmx after the build, and eliminates the smelly
kmx-plus-osk-token.ts file.
A corresponding change has been made to the design document referenced
in #14857.
Test-bot: skip
Move U_25CC to a new CharacterConstants common enumeration.
Rewrite U_ key id conversion to check for invalid characters and report
to the keyboard author with warnings.
Co-authored-by: Eberhard Beilharz <ermshiperete@users.noreply.github.com>
Add support for embedding .keyman-touch-layout into .kmx and complete
support and tests for embedding .kvk. Fixup a number of related
functions.
Add special-key-caps.ts to developer-utils -- in future this will become
the primary source for developer for these key caps, but this cannot be
done until Developer Server and Touch Layout Editor are updated with
Typescript in client code.
The boilerplate code for custom lexical models has never really been
tested. For use in a browser/worker context, we need to define
`exports`. The added unit test verifies that the model will build.
Test-bot: skip
Add a KMX+ file reader and tests, including a round-trip builder:reader
test.
Move basic-17.txt, basic-19.txt, and basic.xml to common test resources
folder so they can be used by unit tests in common and developer.
Test-bot: skip
fs dependency removed from the main hextobin function, only in the
filesystem.ts version. Also supports loading a segment of a hex file
for isolated tests.
Test-bot: skip
Relative paths would cause `kmc copy` to fail to find sources files for
the project, because component paths would be constructed incorrectly.
The cleanest fix is to ensure that we always full resolve local file
paths before attempting to copy the project.
Fixes: #15659
Without `await`, a 'success' message is always returned, because the
Promise that is returned is not nullish. While the log message was
misleading, the outcome was already correct, because the parent function
`copyProject()` did correctly await the call to `doCopy()`.
Fixes: #15699
Test-bot: skip
Address a review comment from #15665 and cleanup additional references
that I missed the first time around, along with the `fs.readFileSync`
`Uint8Array` cast.
Follows: #15665
Test-bot: skip
Use RichEdit's `ITextDocument` interface to retrieve the selection
anchor/caret information, and avoid the side-effects that can arise with
the hacky `EM_GETSEL` / `EM_SETSEL` pattern we used previously.
Changing the selection with `EM_SETSEL` in order to find the anchor
point causes notification messages to be generated that can arrive at an
unexpected time in some text selection scenarios, which ended up with us
having a saved selection in the debugger pointing to the wrong text
range.
The name `Anchor` was a misnomer, because it was actually returning the
caret position, not the anchor for the selection, which is the far side
of the selection from the anchor!
Fixes: #11706
Fixes: KEYMAN-DEVELOPER-18A
The new project UI process detects if the target project folder already
exists in a given path, and asks if the author wants to overwrite it.
However, this has been inconsistently implemented -- in the clone
keyboard case, the process would fail with a message "error KM0B004:
Output path <PATH> already exists, not overwriting". In other cases, no
files would be removed, but existing files would be overwritten where
there was a collision, resulting in a messy project folder.
I have opted to prevent this situation in a consistent manner, requiring
the author to remove the folder themselves in Windows Explorer, even
though this is higher friction, because it pushes them into verifying
that they actually want to delete the contents of the folder.
I also took the opportunity to DRY out this verification process in the
six different New Project dialogs.
Fixes: #15063
Simplify usage of `TestCompilerCallbacks` by making it responsible for
the `beforeEach` and `afterEach` incantations itself. There are a couple
of more complex usages of `TestCompilerCallbacks` which have been
excluded from this change on purpose.
Renamed `testCallbacks` to `callbacks` in the one place where it was
different.
Hoist @types/node and @types/mocha because inconsistent versions of
@types/mocha were causing compiler errors with this change.
Also added a cast to `fs.readFileSync` to `Uint8Array` to eliminate
compiler warnings/errors in test files.
Fixes: #15654
Test-bot: skip