diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2024-07-02 09:20:10 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2024-07-02 09:20:10 +0900 |
| commit | cfc149e99448c68f0d298fd8f99808cd2c36788e (patch) | |
| tree | c8072f3afebb408db98b5b09fdabe96323e7502f | |
| parent | 2faffbd1b7c1941b7f1c1b85cdbb1ca49926866f (diff) | |
| download | fzf-cfc149e99448c68f0d298fd8f99808cd2c36788e.tar.gz | |
Avoid printing ANSI reset codes
fzf --border --bind 'start:transform-border-label:echo -e "\x1b[0mfoo"'
| -rw-r--r-- | src/terminal.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/terminal.go b/src/terminal.go index 6cc46128..abe30a49 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -1006,8 +1006,8 @@ func (t *Terminal) ansiLabelPrinter(str string, color *tui.ColorPair, fill bool) runes := []rune(text) // Simpler printer for strings without ANSI colors or tab characters - if colors == nil && !strings.ContainsRune(str, '\t') { - length := util.StringWidth(str) + if colors == nil && !strings.ContainsRune(text, '\t') { + length := util.StringWidth(text) if length == 0 { return nil, 0 } @@ -1016,9 +1016,9 @@ func (t *Terminal) ansiLabelPrinter(str string, color *tui.ColorPair, fill bool) trimmedRunes, _ := t.trimRight(runes, limit) window.CPrint(*color, string(trimmedRunes)) } else if fill { - window.CPrint(*color, util.RepeatToFill(str, length, limit)) + window.CPrint(*color, util.RepeatToFill(text, length, limit)) } else { - window.CPrint(*color, str) + window.CPrint(*color, text) } } return printFn, length |
