diff options
author | Benjamin Chausse <benjamin@chausse.xyz> | 2024-12-27 17:54:43 -0500 |
---|---|---|
committer | Benjamin Chausse <benjamin@chausse.xyz> | 2024-12-27 17:54:43 -0500 |
commit | 3b8fa0766a0050c0dd026be5d6a1ce2827956530 (patch) | |
tree | e6e6e0d05da592fe36aade35201a52898209ceb1 /internal/picker/picker.go | |
parent | 858c07f0b805558b0961514200ffb822dd2248cf (diff) |
All ui info in one location
Diffstat (limited to 'internal/picker/picker.go')
-rw-r--r-- | internal/picker/picker.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/internal/picker/picker.go b/internal/picker/picker.go index 5a7493d..3094396 100644 --- a/internal/picker/picker.go +++ b/internal/picker/picker.go @@ -5,14 +5,11 @@ import ( "github.com/ChausseBenjamin/termpicker/internal/colors" "github.com/ChausseBenjamin/termpicker/internal/slider" + "github.com/ChausseBenjamin/termpicker/internal/ui" "github.com/charmbracelet/bubbles/key" tea "github.com/charmbracelet/bubbletea" ) -const ( - activeRune = '>' -) - type Model struct { title string active int @@ -114,15 +111,19 @@ func (m Model) Init() tea.Cmd { func (m Model) View() string { var s string - carriageReturn := "" + newline := "" for i, slider := range m.sliders { if i > 0 { - carriageReturn = "\n" + newline = "\n" } if i == m.active { - s += fmt.Sprintf("%v%c %s", carriageReturn, activeRune, slider.View()) + s += fmt.Sprintf("%v%s %s", + newline, + ui.Style().PickerCursor.Render(ui.PickerSelRune), + slider.View(), + ) } else { - s += fmt.Sprintf("%v %s", carriageReturn, slider.View()) + s += fmt.Sprintf("%v %s", newline, slider.View()) } } return s |