mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
Don't try to shorten branch names that are already 3 characters or less
This fixes a potential crash when the available width is very small and the branch name is one to three characters long.
This commit is contained in:
@ -78,7 +78,8 @@ func getBranchDisplayStrings(
|
||||
nameTextStyle = theme.DiffTerminalColor
|
||||
}
|
||||
|
||||
if len(displayName) > availableWidth {
|
||||
// Don't bother shortening branch names that are already 3 characters or less
|
||||
if len(displayName) > utils.Max(availableWidth, 3) {
|
||||
// Never shorten the branch name to less then 3 characters
|
||||
len := utils.Max(availableWidth, 4)
|
||||
displayName = displayName[:len-1] + "…"
|
||||
|
Reference in New Issue
Block a user