diff --git a/internal/ui/dialog/sessions_item.go b/internal/ui/dialog/sessions_item.go index 080de32dba34a8fa50f2b40db2d8335fdcb911d9..9860581eb3c967154b09b42217e2283192962373 100644 --- a/internal/ui/dialog/sessions_item.go +++ b/internal/ui/dialog/sessions_item.go @@ -86,13 +86,20 @@ func renderItem(t *styles.Styles, title string, updatedAt int64, focused bool, w } var ageLen int + var right string + lineWidth := width if updatedAt > 0 { ageLen = lipgloss.Width(age) + lineWidth -= ageLen } - title = ansi.Truncate(title, max(0, width-ageLen), "…") + title = ansi.Truncate(title, max(0, lineWidth), "…") titleLen := lipgloss.Width(title) - right := lipgloss.NewStyle().AlignHorizontal(lipgloss.Right).Width(width - titleLen).Render(age) + + if updatedAt > 0 { + right = lipgloss.NewStyle().AlignHorizontal(lipgloss.Right).Width(width - titleLen).Render(age) + } + content := title if matches := len(m.MatchedIndexes); matches > 0 { var lastPos int