How does Keyman replace key sequence characters with the final character?

Hi, I have a very basic question… When the user of a Keyman keyboard enters a key sequence (like a back-quote and a vowel key to produce “à,” for instance), how does Keyman exactly replace the visible already-entered back-quote with the final character “à”? Is it as simple as Keyman forcing a back-space at the cursor and then the entry of the final character? Or something more complex?

I ask because we’re building a specialized editor using ProseMirror, and we are getting unreliable results using accent plus letter sequences on some Keyman keyboards. I should note that we are able to normally handle all Unicode characters entered through other means.



Keyman has the ability for rules that take into account context. The first rule might be

+ ` > `

The next rule would be based on context (the `) where the rule might be:
` + a > U+0061 U+0300
` + a > U+00E0

Also, some keyboards are written to normally composed (NFC) and some keyboards are written always be decomposed. And then of course some applications might force NFC.

Other keyboards may include rules to handle backspacing so that if you backspace on U+00E0 it might be smart enough to just remove the accent and leave U+0061.

So, it will depend on the keyboard and sometimes even what the application is doing to the underlying text.

Got it!



It sounds to me like you are looking at underlying implementation. What Lorna wrote gives some context on how Keyman rules work: essentially they are transforms of context + keystroke > output, where context is the text already in the document to the left of the input cursor. The integration with apps depends on the application. If you are using apps that support Text Services Framework (for example, Firefox, Word), or on Android or iOS, then Keyman manipulates the text store directly when a keystroke transform is applied. For other applications, on Windows, macOS and Linux, Keyman emits the appropriate number of backspace keystrokes and then emits character events to insert text into the document.

For the backspacing model, where this can be a problem is if the application changes the text store, for example normalising, because Keyman is unable to detect this, and then may emit the wrong number of keystrokes.

Can you give some more context on the issues you are having? A precise reproduction of the issue helps greatly!