From 09a112040fb774e9799dc611736baf405e438b1d Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Sun, 26 Apr 2026 20:18:41 -0400 Subject: [PATCH] fix(ui): notification width and text truncation Prior to this fix, notifications in the footer would not span the width of the window, and text truncation would often happen prematurely. --- internal/ui/model/status.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/ui/model/status.go b/internal/ui/model/status.go index ad6f0f81f776389b3aecfca560967924a47ace09..cf53294cb977866ee7020f7960f7c8464fa9089d 100644 --- a/internal/ui/model/status.go +++ b/internal/ui/model/status.go @@ -101,11 +101,13 @@ func (s *Status) Draw(scr uv.Screen, area uv.Rectangle) { ind := indStyle.String() indWidth := lipgloss.Width(ind) + msgPad := msgStyle.GetPaddingLeft() + msgStyle.GetPaddingRight() + avail := max(0, area.Dx()-indWidth-msgPad) msg := strings.Join(strings.Split(s.msg.Msg, "\n"), " ") - msgWidth := lipgloss.Width(msg) - msg = ansi.Truncate(msg, area.Dx()-indWidth-msgWidth, "…") - padWidth := max(0, area.Dx()-indWidth-msgWidth) - msg += strings.Repeat(" ", padWidth) + msg = ansi.Truncate(msg, avail, "…") + if w := lipgloss.Width(msg); w < avail { + msg += strings.Repeat(" ", avail-w) + } info := msgStyle.Render(msg) // Draw the info message over the help view