diff options
author | Benjamin Chausse <benjamin@chausse.xyz> | 2024-12-28 00:46:18 -0500 |
---|---|---|
committer | Benjamin Chausse <benjamin@chausse.xyz> | 2024-12-28 00:46:18 -0500 |
commit | 101e23780e5f8bc97f5683f5901fbd31f56ce29e (patch) | |
tree | 59a67abf320f8b77440cc7597331796f8b4a57a9 /internal/slider | |
parent | 914633df3e8da138bc2ac78f69fe340832e2283d (diff) |
First attempt at auto-resizecentral-ui
Diffstat (limited to 'internal/slider')
-rw-r--r-- | internal/slider/slider.go | 7 |
1 files changed, 7 insertions, 0 deletions
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 |