1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

Fix truncation of long branch names containing non-ASCII characters

This commit is contained in:
Stefan Haller
2024-06-22 13:34:41 +02:00
parent 7ec784e2a0
commit d406ec06af
2 changed files with 4 additions and 4 deletions

View File

@ -79,10 +79,10 @@ func getBranchDisplayStrings(
}
// Don't bother shortening branch names that are already 3 characters or less
if len(displayName) > max(availableWidth, 3) {
if runewidth.StringWidth(displayName) > max(availableWidth, 3) {
// Never shorten the branch name to less then 3 characters
len := max(availableWidth, 4)
displayName = displayName[:len-1] + "…"
displayName = runewidth.Truncate(displayName, len, "…")
}
coloredName := nameTextStyle.Sprint(displayName)
if checkedOutByWorkTree {