Fix handling of unicode characters in query string

This commit is contained in:
Junegunn Choi 2020-07-28 12:58:37 +09:00
parent 08a6fd4ad4
commit aa5dae391b
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -405,8 +405,8 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
}
renderer = tui.NewLightRenderer(opts.Theme, opts.Black, opts.Mouse, opts.Tabstop, opts.ClearOnExit, false, maxHeightFunc)
}
wordRubout := "[^[:alnum:]][[:alnum:]]"
wordNext := "[[:alnum:]][^[:alnum:]]|(.$)"
wordRubout := "[^\\pL\\pN][\\pL\\pN]"
wordNext := "[\\pL\\pN][^\\pL\\pN]|(.$)"
if opts.FileWord {
sep := regexp.QuoteMeta(string(os.PathSeparator))
wordRubout = fmt.Sprintf("%s[^%s]", sep, sep)
@ -1232,7 +1232,8 @@ func findLastMatch(pattern string, str string) int {
if locs == nil {
return -1
}
return locs[len(locs)-1][0]
prefix := []rune(str[:locs[len(locs)-1][0]])
return len(prefix)
}
func findFirstMatch(pattern string, str string) int {
@ -1244,7 +1245,8 @@ func findFirstMatch(pattern string, str string) int {
if loc == nil {
return -1
}
return loc[0]
prefix := []rune(str[:loc[0]])
return len(prefix)
}
func copySlice(slice []rune) []rune {