diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-26 20:29:35 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-26 20:37:06 +1100 |
commit | d027cf969c56f3dcf8bc3ddd73e09f5ba975677f (patch) | |
tree | 718e7a2935e23ab6051126ce884e943116ea1201 /pkg/gui/presentation | |
parent | c7f68a2ef98543ef3f48d8eda95066b39e07049f (diff) |
better handling of current branch name
Diffstat (limited to 'pkg/gui/presentation')
-rw-r--r-- | pkg/gui/presentation/branches.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/pkg/gui/presentation/branches.go b/pkg/gui/presentation/branches.go index 4283ee1dd..b12ed8ca2 100644 --- a/pkg/gui/presentation/branches.go +++ b/pkg/gui/presentation/branches.go @@ -22,14 +22,18 @@ func GetBranchListDisplayStrings(branches []*commands.Branch, fullDescription bo // getBranchDisplayStrings returns the display string of branch func getBranchDisplayStrings(b *commands.Branch, fullDescription bool) []string { - displayName := utils.ColoredString(b.Name, GetBranchColor(b.Name)) + displayName := b.Name + if b.DisplayName != "" { + displayName = b.DisplayName + } + coloredName := utils.ColoredString(displayName, GetBranchColor(b.Name)) if b.Pushables != "" && b.Pullables != "" && b.Pushables != "?" && b.Pullables != "?" { trackColor := color.FgYellow if b.Pushables == "0" && b.Pullables == "0" { trackColor = color.FgGreen } track := utils.ColoredString(fmt.Sprintf("ā%sā%s", b.Pushables, b.Pullables), trackColor) - displayName = fmt.Sprintf("%s %s", displayName, track) + coloredName = fmt.Sprintf("%s %s", coloredName, track) } recencyColor := color.FgCyan @@ -38,10 +42,10 @@ func getBranchDisplayStrings(b *commands.Branch, fullDescription bool) []string } if fullDescription { - return []string{utils.ColoredString(b.Recency, recencyColor), displayName, utils.ColoredString(b.UpstreamName, color.FgYellow)} + return []string{utils.ColoredString(b.Recency, recencyColor), coloredName, utils.ColoredString(b.UpstreamName, color.FgYellow)} } - return []string{utils.ColoredString(b.Recency, recencyColor), displayName} + return []string{utils.ColoredString(b.Recency, recencyColor), coloredName} } // GetBranchColor branch color |