m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 00:03:39 -05:00

Trim trailing whitespaces after processing ANSI sequences

Close #4282
This commit is contained in:
Junegunn Choi
2025-02-26 16:17:12 +09:00
parent 710ebdf9c1
commit 639253840f
3 changed files with 7 additions and 1 deletions

View File

@@ -184,6 +184,11 @@ func (chars *Chars) TrailingWhitespaces() int {
return whitespaces
}
func (chars *Chars) TrimTrailingWhitespaces() {
whitespaces := chars.TrailingWhitespaces()
chars.slice = chars.slice[0 : len(chars.slice)-whitespaces]
}
func (chars *Chars) TrimSuffix(runes []rune) {
lastIdx := len(chars.slice)
firstIdx := lastIdx - len(runes)