Skip to content

Commit 4e6335d

Browse files
committed
spell: use strings.Cut for the continuation split
Signed-off-by: Joseph Kato <joseph@jdkato.io>
1 parent bf76e1e commit 4e6335d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

internal/spell/aff.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ func newDictConfig(file io.Reader) (*dictConfig, error) { //nolint:funlen
432432
affixText, cont := parts[3], ""
433433
if affixText == "0" {
434434
affixText = ""
435-
} else if i := strings.Index(affixText, "/"); i >= 0 {
435+
} else if text, flags, found := strings.Cut(affixText, "/"); found {
436436
// Split off the affix's own continuation flags, e.g. the
437437
// "/34,22" in `SFX 1 0 t/34,22 e`. Left in place they would
438438
// be appended to the generated word ("stavet/34,22"), so
@@ -442,7 +442,7 @@ func newDictConfig(file io.Reader) (*dictConfig, error) { //nolint:funlen
442442
// classes that apply to the form this rule produces, which
443443
// is how Hunspell builds a word like `stavets` from
444444
// `stave` in two steps. See expand.
445-
affixText, cont = affixText[:i], affixText[i+1:]
445+
affixText, cont = text, flags
446446
}
447447

448448
a.Rules = append(a.Rules, rule{

0 commit comments

Comments
 (0)