From 65087b99497a11393df038bbc212f4eafe9426ee Mon Sep 17 00:00:00 2001 From: semihbkgr Date: Sun, 3 Nov 2024 15:14:37 +0300 Subject: [PATCH] allow prev and next actions even when no options and no filtering --- field_select.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/field_select.go b/field_select.go index 81e57d9e..dbee6074 100644 --- a/field_select.go +++ b/field_select.go @@ -449,9 +449,10 @@ func (s *Select[T]) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } s.updateValue() case key.Matches(msg, s.keymap.Prev): - if s.selected >= len(s.filteredOptions) { + if s.filtering && s.selected >= len(s.filteredOptions) { break } + s.setFiltering(false) s.updateValue() s.err = s.validate(s.accessor.Get()) if s.err != nil { @@ -460,7 +461,7 @@ func (s *Select[T]) Update(msg tea.Msg) (tea.Model, tea.Cmd) { s.updateValue() return s, PrevField case key.Matches(msg, s.keymap.Next, s.keymap.Submit): - if s.selected >= len(s.filteredOptions) { + if s.filtering && s.selected >= len(s.filteredOptions) { break } s.setFiltering(false)