Skip to content

feat: spell checking - #207

Merged
anderix merged 2 commits into
mainfrom
160-spell
Nov 24, 2026
Merged

anderix merged 2 commits into
mainfrom
160-spell

Conversation

@anderix

@anderix anderix commented Nov 24, 2026

Copy link
Copy Markdown
Member

Closes #160

  • odox-ui/src/spell.rs: a Speller over Hunspell dictionaries read by spellbook 0.4.2 (MPL-2.0, no build script, no C; it adds foldhash and hashbrown).
    • for_language(tag) reads a dictionary on its own thread the first time a language is asked for. misspelled(text, lang) works over word_ranges, with results cached per paragraph text.
    • Numbers, words with a digit, and web and mail addresses are skipped.
    • The person's words go in words.txt beside settings.toml. Ignore lasts for the session.
    • Dictionaries in ISO 8859-1 and 8859-15 are decoded.
    • Tests: finds_misspelled_word, language_falls_back_to_language_only, unknown_language_checks_nothing, added_word_not_flagged, numbers_and_urls_skipped and a_latin_dictionary_is_read. They were checked RED with the filters taken out.
  • Core: TextProperties::language comes from fo:language and fo:country, inherited (a_paragraph_is_in_the_language_its_styles_name).
  • Where it shows:
    • Flow records each run's language as the job is built. In edit mode it draws a red wave under unknown words, and a right click offers up to five suggestions, Add to dictionary and Ignore.
    • In xodt a suggestion replaces the word as one undo step, through replace_matches. In xodp it goes through Canvas::corrected.
    • The xods cell editor gets the same, in the cell style's language. Formulas are skipped.
  • Dictionaries: packaging/dictionaries holds en_US, LibreOffice's copy as spellbook vendors it (SCOWL and WordNet licenses), and de_DE_frami (GPL-2.0 or GPL-3.0), each with its license files.
    • The MSIX, install.ps1/uninstall.ps1 and macOS build-app.sh put them beside the executable or in Resources.
    • Linux reads ~/.local/share/hunspell, /usr/share/hunspell and /usr/share/myspell. The .debs recommend hunspell-en-us | hunspell-dictionary.
  • Size: the xodt release binary goes from 23,235,224 to 23,641,168 bytes. The dictionaries are 5.0 MB raw and 1.4 MB zipped in the Windows and macOS packages. NEEDED is unchanged.
  • Checked in Xephyr:
    • xodt: typed text gets waves. Choosing "spelling" from the menu replaces "speling", Ctrl+Z restores it, Ignore takes the wave off "Teh", and reading mode shows none.
    • xodp: a correction from a title's menu takes effect.
    • xods: the cell editor shows waves, and its menu correction is committed.
  • Not checked: Windows and macOS packaging. The VM was off and the Mac has no console session.
  • Also here: Cargo.lock gains futures-lite for odox-ui, which feat: print #206 left out.

@anderix

anderix commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

The review fixes are in the second commit.

Critical

  • 1: the SET line is read from the raw bytes, and both .aff and .dic are decoded with it. a_latin_dictionary_is_read now also checks Häuser and Bäume, and that Straße is offered for Strase; it was RED before the fix.

Important

  • 2: atoms in the offset map (fields, note citations, tracked deletions, tabs) are blanked before checking, via the new OffsetMap::atoms. A correction with an empty model range is dropped (what_stands_for_no_text_is_not_a_word).
    • Checked in Xephyr on your t2.odt: "Jonh Smtih" has no wave, and "tset" after the note citation is now flagged.
  • 3: a dictionary keeps the scripts of its TRY letters, and words in other scripts are not checked (words_in_another_script_are_not_checked; RED before the fix). for_language now answers a Lexicon.
  • 4: band_drawn returns its flow's correction, and Wanted::correct applies it in whichever region is being edited. Checked on pages.odt: "summry" in the header became "summary".
  • 5: codepages.rs is a generated table of Hunspell's single-byte code pages: ISO 8859-1 to -10 and -13 to -15, KOI8-R, KOI8-U, cp1251 and TIS-620. Any other SET is treated as no dictionary (code_pages_decode_their_own_characters). encoding_rs was left out because it has a build script.

Minors fixed

  • 2: paragraphs off screen are skipped.
  • 4: the speller is woken before the first load.
  • 5: a dictionary for the language's own country comes first in the fallback (a_country_of_its_own_comes_first, RED before the fix).
  • 6: covered by the fix for Assemble the Store package on the runner #2.
  • 9: the two packaging comments are removed.

Deferred (recorded in the plan ledger): 1 (no menu on turned labels), 3 (suggest cost), 7 and 8 (the case of personal words, and other windows seeing an added word), and language-asian/-complex/fo:script.

10 (GPL de_DE in the Mac App Store) goes to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spell checking, in all three applications

1 participant