chatterino2 icon indicating copy to clipboard operation
chatterino2 copied to clipboard

feat: spellcheck input

Open Nerixyz opened this issue 7 months ago • 4 comments

Yesterday evening, I wanted to experiment how Hunspell would work in Chatterino. I discovered that it's not that much effort to get spell checking to work.

This is a minimal implementation of spell checking. Dictionaries must be saved as index.aff and index.dic in Dictionaries/ (next to Settings/). You can find dictionaries here (this collects some from various sources).

Features

  • Toggle checking for all inputs in the settings
  • Toggle checking for one input via context menu
  • Apply suggestions via context menu (even when spellchecking is disabled)
  • Works with undo/redo
  • Emotes are ignored

Missing Features (might be cool to have this in the future)

  • Currently, it's bring-your-own-dictionary. It would be cool if Chatterino could install dictionaries.
  • Chatterino could try to access system dictionaries
  • You can't switch the language per split right now.
  • Custom dictionaries would be great (and "Add to dictionary").
  • The spellchecker should be able to reload.

One thing I dislike is that QSyntaxHighlighter is synchronous, meaning it reruns every time a character is typed. Technically, you could hack around that by ignoring its requests to highlight a block and manually call rehighlight (at some timer tick, for example).

Closes #16.

Nerixyz avatar Sep 05 '25 16:09 Nerixyz

5 wrz 2025 18:59:05 nerix @.***>:

One thing I dislike is that QSyntaxHighlighter is synchronous, meaning it reruns every time a character is typed. Technically, you could hack around that by ignoring its requests to highlight a block and manually call rehighlight (at some timer tick, for example). That doesn't seem all that bad. In my experience other programs already behave this way. Ideally I would want the timer to be rather low. I believe most programs currently have this rehighlight timer set WAY too high.

Mm2PL avatar Sep 05 '25 18:09 Mm2PL

probably needs to ignore the leading @mention in replies image

Felanbird avatar Sep 05 '25 23:09 Felanbird

Ideally we should ignore names of people in the chat not just the leading @username for replies

Mm2PL avatar Sep 05 '25 23:09 Mm2PL

I'm fine if this PR doesn't achieve everything we want for a spellcheck input in one go Ignoring mentions seems good for a followup PR Running on a timer instead of each key input seems good for a followup PR

Feature-wise, I feel like we should aim to be only one of "bring your own dictionary" or "supply dictionaries" to start.

pajlada avatar Sep 06 '25 06:09 pajlada