diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2023-09-01 20:28:56 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2023-09-01 20:30:44 +0900 |
| commit | f50a7058d6734b8213fb8bbe6a293b2ffd485eed (patch) | |
| tree | 81cdc89687fff5d3a067498df309a753b4179b60 | |
| parent | 2c74f0a0405bc4d394063bb66f8c6dfd5fe750fa (diff) | |
| download | fzf-f50a7058d6734b8213fb8bbe6a293b2ffd485eed.tar.gz | |
Fix center-alignment of border/preview label
Fix #3421
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | src/terminal.go | 2 | ||||
| -rw-r--r-- | src/util/util_test.go | 7 |
3 files changed, 9 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index deb4ec7c..b22e6670 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ CHANGELOG curl localhost:6266 -H "x-api-key: $FZF_API_KEY" -d 'change-query(yo)' ``` - Added `toggle-header` action +- Bug fixes 0.42.0 ------ diff --git a/src/terminal.go b/src/terminal.go index c7e86209..6418a5df 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -781,7 +781,7 @@ func (t *Terminal) ansiLabelPrinter(str string, color *tui.ColorPair, fill bool) window.CPrint(*color, str) } } - return printFn, len(text) + return printFn, length } // Printer that correctly handles ANSI color codes and tab characters diff --git a/src/util/util_test.go b/src/util/util_test.go index 27e7a049..42a66636 100644 --- a/src/util/util_test.go +++ b/src/util/util_test.go @@ -184,3 +184,10 @@ func TestRepeatToFill(t *testing.T) { t.Error("Expected:", strings.Repeat("abcde", 4)+"abcde"[:2]) } } + +func TestStringWidth(t *testing.T) { + w := StringWidth("─") + if w != 1 { + t.Errorf("Expected: %d, Actual: %d", 1, w) + } +} |
