diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2025-02-26 16:17:12 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2025-02-26 16:17:12 +0900 |
| commit | 639253840fc553cc6a082b3f1275e72903ecc0eb (patch) | |
| tree | ee2f85e02020ea3e2bcc7f7afcba4caf7b698eaf /src/util | |
| parent | 710ebdf9c14e0c88b0cfc843ce08edcdd4554571 (diff) | |
| download | fzf-639253840fc553cc6a082b3f1275e72903ecc0eb.tar.gz | |
Trim trailing whitespaces after processing ANSI sequences
Close #4282
Diffstat (limited to 'src/util')
| -rw-r--r-- | src/util/chars.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/util/chars.go b/src/util/chars.go index adde02a6..dd037caa 100644 --- a/src/util/chars.go +++ b/src/util/chars.go @@ -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) |
