diff --git a/ui/components/pr/pr.go b/ui/components/pr/pr.go index 1f01e18e..1cc81438 100644 --- a/ui/components/pr/pr.go +++ b/ui/components/pr/pr.go @@ -127,12 +127,13 @@ func (pr *PullRequest) renderLines() string { deletions = pr.Data.Deletions } - diffs := "\033[32m+%s \033[31m-%s" - return pr.getTextStyle().Render( - fmt.Sprintf( - diffs, - components.FormatNumber(pr.Data.Additions), - components.FormatNumber(deletions), + return pr.getTextStyle().Render( + components.KeepSameSpacesOnAddDeletions( + fmt.Sprintf( + "\033[32m+%s \033[31m-%s", + components.FormatNumber(pr.Data.Additions), + components.FormatNumber(deletions), + ), ), ) } diff --git a/ui/components/utils.go b/ui/components/utils.go index 72078e66..2e41583c 100644 --- a/ui/components/utils.go +++ b/ui/components/utils.go @@ -9,6 +9,11 @@ import ( "github.com/dlvhdr/gh-dash/ui/context" ) +func KeepSameSpacesOnAddDeletions(str string) string { + str_as_list := strings.Split(str, " ") + return fmt.Sprintf("%7s", str_as_list[0]) + " " + fmt.Sprintf("%7s", str_as_list[1]) +} + func FormatNumber(num int) string { if num >= 1000000 { million := float64(num) / 1000000.0