Skip to content

Commit

Permalink
Add Cursor() methods to Select and MultiSelect fields
Browse files Browse the repository at this point in the history
  • Loading branch information
kralicky committed Sep 10, 2024
1 parent a9285a0 commit 781f516
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions field_multiselect.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ func (m *MultiSelect[T]) Blur() tea.Cmd {
return nil
}

// Cursor returns the position of the cursor within the multi-select.
func (m *MultiSelect[T]) Cursor() int {
return m.cursor
}

// KeyBinds returns the help message for the multi-select field.
func (m *MultiSelect[T]) KeyBinds() []key.Binding {
binds := []key.Binding{
Expand Down
5 changes: 5 additions & 0 deletions field_select.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@ func (s *Select[T]) Blur() tea.Cmd {
return nil
}

// Cursor returns the position of the cursor within the select field.
func (m *Select[T]) Cursor() int {
return m.selected
}

// KeyBinds returns the help keybindings for the select field.
func (s *Select[T]) KeyBinds() []key.Binding {
return []key.Binding{
Expand Down

0 comments on commit 781f516

Please sign in to comment.