From 56a17a3b50969a09d5688823d1b9fa227794183c Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Tue, 31 Oct 2023 15:53:07 -0400 Subject: [PATCH] feat(ui): show committer in blame --- pkg/ui/pages/repo/files.go | 4 +++- pkg/ui/styles/styles.go | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/ui/pages/repo/files.go b/pkg/ui/pages/repo/files.go index 259adf5f1d44422363ce3e4e97a87072e87d9171..cd7b2411e703b77e5c1cf7c2a06e20adb2da4bd7 100644 --- a/pkg/ui/pages/repo/files.go +++ b/pkg/ui/pages/repo/files.go @@ -497,9 +497,11 @@ func renderBlame(c common.Common, f *FileItem, b *gitm.Blame) string { if commit == nil { break } - line := fmt.Sprintf("%s %s", + who := fmt.Sprintf("%s <%s>", commit.Author.Name, commit.Author.Email) + line := fmt.Sprintf("%s %s %s", c.Styles.Tree.Blame.Hash.Render(commit.ID.String()[:7]), c.Styles.Tree.Blame.Message.Render(commit.Summary()), + c.Styles.Tree.Blame.Who.Render(who), ) if line != prev { lines = append(lines, line) diff --git a/pkg/ui/styles/styles.go b/pkg/ui/styles/styles.go index fbaab60151e696557ba5325efdcd939cdbe83307..c8bc0aa53dfa4dae0d4b813f8211dcd772396fa6 100644 --- a/pkg/ui/styles/styles.go +++ b/pkg/ui/styles/styles.go @@ -126,6 +126,7 @@ type Styles struct { Blame struct { Hash lipgloss.Style Message lipgloss.Style + Who lipgloss.Style } } @@ -446,6 +447,9 @@ func DefaultStyles() *Styles { s.Tree.Blame.Message = lipgloss.NewStyle() + s.Tree.Blame.Who = lipgloss.NewStyle(). + Faint(true) + s.Spinner = lipgloss.NewStyle(). MarginTop(1). MarginLeft(2).