56a17a3b50969a09d5688823d1b9fa227794183c

Author
Ayman Bagabas <ayman.bagabas@gmail.com>
Committer
Ayman Bagabas <ayman.bagabas@gmail.com>
Date

Message

feat(ui): show committer in blame

Diff

 1diff --git a/pkg/ui/pages/repo/files.go b/pkg/ui/pages/repo/files.go
 2index 259adf5f1d44422363ce3e4e97a87072e87d9171..cd7b2411e703b77e5c1cf7c2a06e20adb2da4bd7 100644
 3--- a/pkg/ui/pages/repo/files.go
 4+++ b/pkg/ui/pages/repo/files.go
 5@@ -497,9 +497,11 @@ func renderBlame(c common.Common, f *FileItem, b *gitm.Blame) string {
 6 		if commit == nil {
 7 			break
 8 		}
 9-		line := fmt.Sprintf("%s %s",
10+		who := fmt.Sprintf("%s <%s>", commit.Author.Name, commit.Author.Email)
11+		line := fmt.Sprintf("%s %s %s",
12 			c.Styles.Tree.Blame.Hash.Render(commit.ID.String()[:7]),
13 			c.Styles.Tree.Blame.Message.Render(commit.Summary()),
14+			c.Styles.Tree.Blame.Who.Render(who),
15 		)
16 		if line != prev {
17 			lines = append(lines, line)
18diff --git a/pkg/ui/styles/styles.go b/pkg/ui/styles/styles.go
19index fbaab60151e696557ba5325efdcd939cdbe83307..c8bc0aa53dfa4dae0d4b813f8211dcd772396fa6 100644
20--- a/pkg/ui/styles/styles.go
21+++ b/pkg/ui/styles/styles.go
22@@ -126,6 +126,7 @@ type Styles struct {
23 		Blame       struct {
24 			Hash    lipgloss.Style
25 			Message lipgloss.Style
26+			Who     lipgloss.Style
27 		}
28 	}
29 
30@@ -446,6 +447,9 @@ func DefaultStyles() *Styles {
31 
32 	s.Tree.Blame.Message = lipgloss.NewStyle()
33 
34+	s.Tree.Blame.Who = lipgloss.NewStyle().
35+		Faint(true)
36+
37 	s.Spinner = lipgloss.NewStyle().
38 		MarginTop(1).
39 		MarginLeft(2).