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

Preserve the original color of each token when using --with-nth with --ansi

Close #1500
This commit is contained in:
Junegunn Choi
2019-03-06 19:05:05 +09:00
parent b7c6838e45
commit ef577a6509
4 changed files with 107 additions and 3 deletions

View File

@@ -171,3 +171,12 @@ func (chars *Chars) CopyRunes(dest []rune) {
}
return
}
func (chars *Chars) Wrap(prefix string, suffix string) {
if runes := chars.optionalRunes(); runes != nil {
runes = append(append([]rune(prefix), runes...), []rune(suffix)...)
chars.slice = *(*[]byte)(unsafe.Pointer(&runes))
} else {
chars.slice = append(append([]byte(prefix), chars.slice...), []byte(suffix)...)
}
}