Fix center-alignment of border/preview label

Fix #3421
This commit is contained in:
Junegunn Choi 2023-09-01 20:28:56 +09:00
parent 2c74f0a040
commit f50a7058d6
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627
3 changed files with 9 additions and 1 deletions

View File

@ -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
------

View File

@ -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

View File

@ -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)
}
}