From c410362a452e1d9d4321a4a46eecbd1413d74ebf Mon Sep 17 00:00:00 2001 From: ardnew Date: Mon, 11 Dec 2023 12:55:35 -0600 Subject: [PATCH] fix max width logic To ensure the form is no greater than maxWidth, we need to take the minimum among the desired width and maxWidth. Taking the maximum among these values effectively changes the logic to ensure the form is no less than maxWidth (in which case, it should probably be called minWidth). --- examples/bubbletea/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/bubbletea/main.go b/examples/bubbletea/main.go index f315d589..6d59f6a9 100644 --- a/examples/bubbletea/main.go +++ b/examples/bubbletea/main.go @@ -112,7 +112,7 @@ func (m Model) Init() tea.Cmd { func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { switch msg := msg.(type) { case tea.WindowSizeMsg: - m.width = max(msg.Width, maxWidth) - m.styles.Base.GetHorizontalFrameSize() + m.width = min(msg.Width, maxWidth) - m.styles.Base.GetHorizontalFrameSize() case tea.KeyMsg: switch msg.String() { case "esc", "ctrl+c", "q":