Show delivery failure reason in red on the queue status bar

Right-align the postqueue failure reason in red on the same status bar
line, rendered as a separate segment with matching background to avoid
breaking the layout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
nemunaire 2026-03-29 19:55:52 +07:00
commit 1752562279

View file

@ -43,7 +43,7 @@ type Model struct {
saveNotice string saveNotice string
width int width int
height int height int
messageSaving bool messageSaving bool
// stateParts fields // stateParts fields
parts []MessagePart parts []MessagePart
partsCursor int partsCursor int
@ -478,13 +478,17 @@ func (m Model) renderBottom() string {
label := fmt.Sprintf(" Fetching subjects: %d / %d ", m.loadingDone, m.loadingTotal) label := fmt.Sprintf(" Fetching subjects: %d / %d ", m.loadingDone, m.loadingTotal)
return dimStyle.Render(label) + "\n " + m.progress.View() return dimStyle.Render(label) + "\n " + m.progress.View()
} }
status := statusBarStyle.Render( left := fmt.Sprintf(" %d message(s) │ Enter: open │ r: refresh │ F: flush │ q: quit ", len(m.list.Items()))
fmt.Sprintf(" %d message(s) │ Enter: open │ r: refresh │ F: flush │ q: quit ", len(m.list.Items())), reason := ""
)
if item, ok := m.list.SelectedItem().(queueItem); ok { if item, ok := m.list.SelectedItem().(queueItem); ok {
if reason := item.entry.Reason; reason != "" { reason = item.entry.Reason
return status + "\n " + reasonStyle.Render(reason)
}
} }
return status if reason == "" {
return statusBarStyle.Render(left)
}
right := " " + reason + " "
rightWidth := lipgloss.Width(right)
leftPart := statusBarStyle.Width(m.width - rightWidth).Render(left)
rightPart := lipgloss.NewStyle().Foreground(lipgloss.Color("196")).Background(lipgloss.Color("241")).Render(right)
return leftPart + rightPart
} }