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

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

No files matched your search

+9
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)...)
}
}