hints: fix select by word broken while porting to Go

This commit is contained in:
Kovid Goyal
2023-03-14 12:27:33 +05:30
parent c0c0fd8ac1
commit 3741d3d1be

View File

@@ -258,7 +258,8 @@ func functions_for(opts *Options) (pattern string, post_processors []PostProcess
chars = RelevantKittyOpts().Select_by_word_characters
}
chars = regexp.QuoteMeta(chars)
pattern = fmt.Sprintf(`(?u)[%s\pL\pN]{%d,}`, chars, opts.MinimumMatchLength)
chars = strings.ReplaceAll(chars, "-", "\\-")
pattern = fmt.Sprintf(`[%s\pL\pN]{%d,}`, chars, opts.MinimumMatchLength)
post_processors = append(post_processors, PostProcessorMap()["brackets"], PostProcessorMap()["quotes"])
default:
pattern = opts.Regex