I'm working on a crossplatform note taking application, and part of our effort includes building a text editor from the ground up that we can bring to our various platforms. For us, on iOS this means conforming to the UITextInput
protocol. The rendering of our document, cursor, etc happen via an MTKView
which is managed by our Rust code. This works great and we've been able to bring this to a handful of platforms, the latest of which is iOS.
Text insertion, autocorrect, selection all work as expected, however when using a hardware keyboard on iPad (or iPhone) I'm seeing some strange behavior that I'm not able to understand or find any answers about on the internet.
When I type option+backspace at the end of a sentence, rather than deleting word by word, the input system first highlights the word, and then the next backspace calls deleteBackwards()
.
My code is available for scrutiny here.
And the project can be downloaded here (to avoid the need for installing the rust toolchain).
I've experimented briefly with other approaches (you may see the debugging efforts commented out on my branch) like UIKeyCommand
or overriding pressesBegan
, I'm open to pursuing these further but I have a feeling I'm not heading in the right direction and that it's time to ask for help.
I've also scrutinized the intermediate calls that the text system makes, and my replies to them. You can find those logs here. All my calls and responses look reasonable to me. There's still some unimplemented functions but I know those aren't being called because I placed an exit()
call in them.