From 0a1e84fd5f7beebf52a25d7bdcc8626af16fb8a9 Mon Sep 17 00:00:00 2001 From: pomdtr Date: Thu, 16 Nov 2023 03:10:48 +0100 Subject: [PATCH] fix cursor > len(filtered) on reload --- internal/tui/filter.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/tui/filter.go b/internal/tui/filter.go index 22c99702..25be351e 100644 --- a/internal/tui/filter.go +++ b/internal/tui/filter.go @@ -112,6 +112,10 @@ func (f *Filter) FilterItems(query string) { } f.filtered = filtered + + if f.cursor >= len(f.filtered) { + f.cursor = len(f.filtered) - 1 + } } func (f *Filter) Select(id string) {