summaryrefslogtreecommitdiff
path: root/menu
diff options
context:
space:
mode:
authorewy <ewy0@protonmail.com>2026-04-17 00:05:32 +0200
committerewy <ewy0@protonmail.com>2026-04-17 00:05:32 +0200
commit809b28e3de2ea1bcaecc44a0872df26aa22b3ba2 (patch)
treed9474487501a484379f6a9b6004338a8b46f204b /menu
parent022072ce8bac114ea0a7b94132ed3b8630de2f90 (diff)
fix git stuff failing when no changes
Diffstat (limited to 'menu')
-rw-r--r--menu/source.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/menu/source.go b/menu/source.go
index efe4e0a..913c1ce 100644
--- a/menu/source.go
+++ b/menu/source.go
@@ -100,12 +100,18 @@ var (
)
func Git(info *model.GitInfo) string {
-
- return GitInfoStyle.Render(lipgloss.JoinHorizontal(lipgloss.Left,
+ var parts = []string{
" ",
info.Branch,
- GitAddStyle.Render("+"+strconv.Itoa(info.Insertions)),
- GitRemoveStyle.Render("-"+strconv.Itoa(info.Deletions)),
- GitChangeStyle.Render("~"+strconv.Itoa(info.Changes)),
+ }
+
+ if info.Insertions > 0 {
+ parts = append(parts, GitAddStyle.Render("+"+strconv.Itoa(info.Insertions)))
+ parts = append(parts, GitRemoveStyle.Render("-"+strconv.Itoa(info.Deletions)))
+ parts = append(parts, GitChangeStyle.Render("~"+strconv.Itoa(info.Changes)))
+ }
+
+ return GitInfoStyle.Render(lipgloss.JoinHorizontal(lipgloss.Left,
+ parts...,
))
}