is there a spellchecker for compose text input fie...
# compose-desktop
z
is there a spellchecker for compose text input field? thats sort of easy "plug and play"? or something close to it? but offline, no internet connection needed
s
a
@Zoff tl;dr No. I've been on this quest for about a year now LoL. 😄😭 I got the SymSpell algorithm ported as you see there ⬆️. But the other half of the equation: Implementing it on a TextField has so far proven impossible. I have been working on trying to get it integrated with @mohamed rejebs excellent compose-rich-editor library. I have several open PRs that actually pretty much get it working, however there is a critical problem relating to the fact that in the end, it is still based on
BasicTextField
which has certain limitations I don't think are possible to overcome. (It breaks when you internally scroll the text) I've spent a few nights in recent weeks seeing how crazy of an idea it would be to write my own replacement for
BasicTextField
to overcome these limitations. And that actually has been going quite a bit better than expected. It's maybe 80% done? I am worried about the long tail of bugs trying to get it to behave correctly on all platforms though. I'm also reticent to plow too much time into this custom Textfield replacement as the Compose team knows this is a missing piece of the ecosystem, and has a couple items on their roadmap to eventually plug the gap. Unfortunately their solution is probably not coming any time soon, so I'm back to either giving up on it for now, or charging forward on the
BasicTextField
rewrite. That all being said, if you, or anyone else was interested on collaborating on the rewrite, I'm actually pretty close to being feature complete. Just need help chasing down some remaining bugs relating to undo/redo history (it's pretty tricky with SpanStyles!). Feel free to DM me and I can throw up what I've got so far in a repo.
This is what I have working so far: • Rich text rendering and editable ◦ Semi-efficient rendering for long form text (only renders what is visible) ◦ Semi-efficient data structure for text storage & editing. (but not nearly as efficient as the Gap Buffer BTF2 uses under the hood) • Cursor movement, clicking, keyboard short cuts, ect • Text selection (highlighting and edit ops) • copy/cut/paste • Exposed scroll state, so we can render scroll bars (BTF1 can't do this) • Doesn't copy and return full contents on each edit, so again better for longer form text. (BTF2 also works this way, but BTF2 doesn't support
AnnotatedString
for rich content
) • Support custom Rich Span drawing (this allows us to render the traditional Spell Check red squiggle) • Emits edit events: so if a single character is inserted, you can collect a Flow, and know exactly what change was made. This makes managing Spell Check much more efficient as you can just respell-check the single word that was changed, rather than everything. Currently neither BTF1 or BTF2 offers this. • Undo/Redo history: This is the last major feature, it's partially implemented, but a bit buggy at the moment
👍 1
Me for the past several months trying to get Spell Checking in Compose Multiplatform
😄 1
👀 1