Skip to content

Spellchecker incorrectly flags words followed by a non-breaking space as misspelled #903

Description

@Melud

Description

Description

In French typography, it is standard to insert a non-breaking space before certain punctuation marks (; ! ?, and also before : and inside French quotation marks « »). Two distinct Unicode characters are used for this depending on the software/context: the no-break space (U+00A0) and the narrow no-break space (U+202F). Both should be treated as word boundaries by the spellchecker.

When such a space is typed directly in the web editor, the spellchecker appears to treat it as part of the preceding word rather than as a word boundary. As a result, correctly spelled words get flagged as misspelled, because the token being checked effectively becomes word<NBSP> instead of word.

This causes the spellchecker to flag normal, correctly-written French sentences whenever proper French typography (non-breaking spaces before punctuation) is used.

Expected behavior

Any non-breaking space variant should be treated as whitespace/word boundary by the spellchecker, just like a regular space.

Actual behavior

The non-breaking space is included as part of the preceding word's token, causing correctly spelled words to be flagged as errors.

Minimal Example
Image

Reproduction URL

https://typst.app/project/r3XrXTdM7VFONN72ZQ7Wsw

Browsers

Firefox

OS

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working.spellcheckAbout spellcheck.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions