From 625f49462338e7931cd97170d6ff6463b2b6b13a Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Thu, 27 Aug 2026 13:31:09 +0200 Subject: [PATCH] fix: Items take full width for bubblezone to work everywhere Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com> --- ui/delegate.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/ui/delegate.go b/ui/delegate.go index 04eb23a..861efff 100644 --- a/ui/delegate.go +++ b/ui/delegate.go @@ -27,6 +27,16 @@ func clampToWidth(s string, width int) string { return ansi.Truncate(s, width, "…") } +func padToWidth(s string, width int) string { + if width <= 0 { + return s + } + if w := ansi.StringWidth(s); w < width { + s += strings.Repeat(" ", width-w) + } + return s +} + type entryDelegate struct{} func (d entryDelegate) Height() int { return cardHeight } @@ -76,10 +86,10 @@ func (d entryDelegate) Render(w io.Writer, m list.Model, index int, item list.It } lines := []string{ - clampToWidth(side.Render(line1), width), - clampToWidth(side.Render(line2), width), - clampToWidth(side.Render(line3), width), - clampToWidth(side.Render(line4), width), + padToWidth(clampToWidth(side.Render(line1), width), width), + padToWidth(clampToWidth(side.Render(line2), width), width), + padToWidth(clampToWidth(side.Render(line3), width), width), + padToWidth(clampToWidth(side.Render(line4), width), width), } fmt.Fprint(w, zone.Mark(entryZoneID(index), strings.Join(lines, "\n"))) }