From 101e23780e5f8bc97f5683f5901fbd31f56ce29e Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Sat, 28 Dec 2024 00:46:18 -0500 Subject: First attempt at auto-resize --- internal/slider/slider.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'internal/slider') diff --git a/internal/slider/slider.go b/internal/slider/slider.go index dbf4093..7e1b76c 100644 --- a/internal/slider/slider.go +++ b/internal/slider/slider.go @@ -34,6 +34,13 @@ func New(label byte, maxVal int, opts ...progress.Option) Model { func (m Model) Title() string { return fmt.Sprintf("%c:", m.label) } +func (m Model) Width() int { return m.progress.Width } + +func (m Model) SetWidth(w int) (tea.Model, tea.Cmd) { + m.progress.Width = w + return m, nil +} + func (m Model) Init() tea.Cmd { // Triggering a frame message Update here will force the progress bar to // render immediately. This is necessary because progress bars only render -- cgit v1.2.3