MCPcopy Create free account
hub / github.com/cogentcore/core / correctText

Method correctText

texteditor/buffer.go:1059–1071  ·  view source on GitHub ↗

correctText edits the text using the string chosen from the correction menu

(s string)

Source from the content-addressed store, hash-verified

1057
1058// correctText edits the text using the string chosen from the correction menu
1059func (tb *Buffer) correctText(s string) {
1060 st := lexer.Pos{tb.spell.srcLn, tb.spell.srcCh} // start of word
1061 tb.RemoveTag(st, token.TextSpellErr)
1062 oend := st
1063 oend.Ch += len(tb.spell.word)
1064 tb.ReplaceText(st, oend, st, s, EditSignal, ReplaceNoMatchCase)
1065 if tb.currentEditor != nil {
1066 ep := st
1067 ep.Ch += len(s)
1068 tb.currentEditor.SetCursorShow(ep)
1069 tb.currentEditor = nil
1070 }
1071}
1072
1073// SpellCheckLineErrors runs spell check on given line, and returns Lex tags
1074// with token.TextSpellErr for any misspelled words

Callers 1

setSpellMethod · 0.95

Calls 3

ReplaceTextMethod · 0.95
RemoveTagMethod · 0.80
SetCursorShowMethod · 0.80

Tested by

no test coverage detected