m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-16 15:23:48 -05:00

Further reduce unnecessary rune array conversion

I was too quick to release 0.16.9, this commit makes --ansi processing
even faster.
This commit is contained in:
Junegunn Choi
2017-07-21 17:29:14 +09:00
parent 06301c7847
commit bd98f988f0
6 changed files with 10 additions and 11 deletions

View File

@@ -69,14 +69,14 @@ func Run(opts *Options, revision string) {
ansiProcessor = func(data []byte) (util.Chars, *[]ansiOffset) {
trimmed, offsets, newState := extractColor(string(data), state, nil)
state = newState
return util.RunesToChars([]rune(trimmed)), offsets
return util.ToChars([]byte(trimmed)), offsets
}
} else {
// When color is disabled but ansi option is given,
// we simply strip out ANSI codes from the input
ansiProcessor = func(data []byte) (util.Chars, *[]ansiOffset) {
trimmed, _, _ := extractColor(string(data), nil, nil)
return util.RunesToChars([]rune(trimmed)), nil
return util.ToChars([]byte(trimmed)), nil
}
}
}