Skip to content

Commit

Permalink
fix: spacing and always use last commit msg in ui
Browse files Browse the repository at this point in the history
  • Loading branch information
dlvhdr committed Sep 6, 2024
1 parent 0dfd6ac commit 439f61c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 3 additions & 5 deletions ui/components/branch/branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (b *Branch) renderExtendedTitle(isSelected bool) string {
baseStyle := b.getBaseStyle(isSelected)
width := b.getMaxWidth()

title := b.renderPRTitleOrCommigMsg(isSelected, width)
title := b.renderLastCommigMsg(isSelected, width)
branch := b.renderBranch(isSelected, width)
return baseStyle.Render(lipgloss.JoinVertical(lipgloss.Left, branch, title))
}
Expand Down Expand Up @@ -332,12 +332,10 @@ func (b *Branch) renderCommitsAheadBehind(isSelected bool) string {
return lipgloss.JoinHorizontal(lipgloss.Top, commitsAhead, commitsBehind)
}

func (b *Branch) renderPRTitleOrCommigMsg(isSelected bool, width int) string {
func (b *Branch) renderLastCommigMsg(isSelected bool, width int) string {
baseStyle := b.getBaseStyle(isSelected)
title := "-"
if b.PR != nil {
title = fmt.Sprintf("#%d %s", b.PR.Number, b.PR.Title)
} else if b.Data.LastCommitMsg != nil {
if b.Data.LastCommitMsg != nil {
title = *b.Data.LastCommitMsg
}
return baseStyle.Foreground(b.Ctx.Theme.SecondaryText).Width(width).MaxWidth(width).Render(title)
Expand Down
1 change: 1 addition & 0 deletions ui/components/branchsidebar/branchsidebar.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func (m Model) View() string {

s.WriteString(m.branch.Data.Name)
if m.branch.PR != nil {
s.WriteString("\n")
s.WriteString(fmt.Sprintf("#%d %s", m.branch.PR.GetNumber(), m.branch.PR.Title))
}

Expand Down

0 comments on commit 439f61c

Please sign in to comment.