From 1ba1200c31f7177dd24aa884ef9df60b00f76479 Mon Sep 17 00:00:00 2001 From: Ivan Valdes Date: Thu, 15 Jun 2023 10:09:48 -0700 Subject: [PATCH] fix(viewport): pad width to contentWidth --- viewport/viewport.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/viewport/viewport.go b/viewport/viewport.go index 019da7d..0a5a73a 100644 --- a/viewport/viewport.go +++ b/viewport/viewport.go @@ -373,9 +373,10 @@ func (m Model) View() string { contentWidth := w - m.Style.GetHorizontalFrameSize() contentHeight := h - m.Style.GetVerticalFrameSize() contents := lipgloss.NewStyle(). + Width(contentWidth). // pad to width. Height(contentHeight). // pad to height. MaxHeight(contentHeight). // truncate height if taller. - MaxWidth(contentWidth). // truncate width. + MaxWidth(contentWidth). // truncate width if wider. Render(strings.Join(m.visibleLines(), "\n")) return m.Style.Copy(). UnsetWidth().UnsetHeight(). // Style size already applied in contents.