SpellCheckState

class SpellCheckState(val textState: TextEditorState, var spellChecker: EditorSpellChecker?, enableSpellChecking: Boolean = true, var spellCheckMode: SpellCheckMode = SpellCheckMode.Word, scanContext: CoroutineContext = Dispatchers.Default)(source)

Constructors

Link copied to clipboard
constructor(textState: TextEditorState, spellChecker: EditorSpellChecker?, enableSpellChecking: Boolean = true, spellCheckMode: SpellCheckMode = SpellCheckMode.Word, scanContext: CoroutineContext = Dispatchers.Default)

Properties

Link copied to clipboard

Words the user chose to ignore this session, through ignoreWord.

Link copied to clipboard
Link copied to clipboard

Whether spell checking is currently active. Toggle via setSpellCheckingEnabled.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun applySentenceCorrection(correction: Correction, selectedSuggestion: String)

Apply a sentence-level correction. Its flag is kept as correctSpelling keeps a word's.

Link copied to clipboard
suspend fun checkWordSegment(segment: WordSegment): Boolean

Run spell check on a specific word segment. This will remove any existing spell check spans for the word and add a new one if misspelled.

Link copied to clipboard
fun correctSpelling(segment: WordSegment, correction: String)

Replace a misspelled word with the chosen correction.

Link copied to clipboard
suspend fun getSuggestions(word: String): List<Suggestion>

Gather correction suggestions for a word.

Link copied to clipboard

Handle click for sentence-level corrections only. Use this when you specifically need a Correction.

Link copied to clipboard

Handle click on a spell check span.

Link copied to clipboard

Handle click for word-level misspellings only. Use this when you specifically need a WordSegment.

Link copied to clipboard
fun ignoreWord(word: String)

Stop flagging word for the rest of this session, whichever checker is in use, and clear its current flags. word is the flagged text: the word, or a sentence issue's Correction.originalText, which is matched exactly. A word in lowercase also clears capitalised and in capitals, as a dictionary matches case; one capitalised only at its start is taken for a sentence's first word and matched as its lowercase. One with other capitals, such as "NASA" or "iPhone", clears only as written.

Link copied to clipboard

Remove spell-check decorations affected by an edit operation.

Remove the spell-check decorations operations affected, edits that landed one after another with no other since: each is read in the text after it, as moved by those after it. See the overload for one edit.

Link copied to clipboard
suspend fun runFullSpellCheck()

Run full spell check based on the current mode.

Link copied to clipboard

Run partial spell check based on the current mode.

Link copied to clipboard
suspend fun setSpellCheckingEnabled(value: Boolean)

Enable or disable spell checking.