on main help sign in
fix(ui): correct off-by-one in attachment 'N more' count

When the number of attachments exceeded the display width, the item at index 'fits' was already rendered as a chip but was also counted in the 'N more...' text. Fixed condition to only show 'more' when items remain beyond the rendered one, and adjusted count to exclude the already-rendered item.

commita9b1350b73a72f5c40c071cb7a511a172c1d614e authoriko <mail@iko.soy> dateThu 9 Jul 2026, 03:06 (3 months ago) parent490c2f8
1 file changed+2−2
internal/ui/attachments/attachments.go+2−2
internal/ui/attachments/attachments.go+2−2
@@ -132,8 +132,8 @@ func (r *Renderer) Render(attachments []message.Attachment, deleting bool, width
132132 )
133133 }
134134
135− if i == fits && len(attachments) > i {
136− chips = append(chips, lipgloss.NewStyle().Width(maxItemWidth).Render(fmt.Sprintf("%d more…", len(attachments)-fits)))
135+ if i == fits && len(attachments) > i+1 {
136+ chips = append(chips, lipgloss.NewStyle().Width(maxItemWidth).Render(fmt.Sprintf("%d more…", len(attachments)-fits-1)))
137137 break
138138 }
139139 }