summaryrefslogtreecommitdiff
path: root/internal/slider/slider.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/slider/slider.go')
-rw-r--r--internal/slider/slider.go22
1 files changed, 17 insertions, 5 deletions
diff --git a/internal/slider/slider.go b/internal/slider/slider.go
index 0c0a89e..e882a29 100644
--- a/internal/slider/slider.go
+++ b/internal/slider/slider.go
@@ -51,8 +51,13 @@ func (s Slider) Dec(val int) (tea.Model, tea.Cmd) {
return s.Set(s.val - val)
}
-func (s Slider) View() string {
- return s.bar.View() + fmt.Sprintf(" (%d)", s.val)
+func (s Slider) Val() int {
+ return s.val
+}
+
+func New(name string, v int, maxV int, opt ...progress.Option) *Slider {
+ opt = append(opt, progress.WithoutPercentage())
+ return &Slider{name: name, max: maxV, val: v, options: opt}
}
func (s Slider) Animate(msg tea.Msg) (tea.Model, tea.Cmd) {
@@ -66,9 +71,8 @@ func (s Slider) Init() tea.Cmd {
return s.bar.Init()
}
-func New(name string, v int, maxV int, opt ...progress.Option) *Slider {
- opt = append(opt, progress.WithoutPercentage())
- return &Slider{name: name, max: maxV, val: v, options: opt}
+func (s Slider) View() string {
+ return s.bar.View() + fmt.Sprintf(" (%d)", s.val)
}
func (s Slider) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
@@ -103,3 +107,11 @@ func (s Slider) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
// }}}
+// Implement the list.Item interface {{{
+
+func (s Slider) FilterValue() string {
+ // Sliders shouldn't be filtered
+ return ""
+}
+
+// }}}