m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-19 00:53:42 -05:00

with-nth: Do not trim trailing whitespaces with background colors

Example:
  echo -en '  \e[48;5;232mhello\e[48;5;147m  ' | fzf --ansi --with-nth 1
This commit is contained in:
Junegunn Choi
2025-06-24 20:23:30 +09:00
parent 330a85c25c
commit 8d81730ec2
2 changed files with 14 additions and 3 deletions

View File

@@ -184,9 +184,10 @@ func (chars *Chars) TrailingWhitespaces() int {
return whitespaces
}
func (chars *Chars) TrimTrailingWhitespaces() {
func (chars *Chars) TrimTrailingWhitespaces(maxIndex int) {
whitespaces := chars.TrailingWhitespaces()
chars.slice = chars.slice[0 : len(chars.slice)-whitespaces]
end := len(chars.slice) - whitespaces
chars.slice = chars.slice[0:Max(end, maxIndex)]
}
func (chars *Chars) TrimSuffix(runes []rune) {