fix: TUI selection underflow and filtered-results desync

Three related TUI correctness bugs:

- download_selector navigation (select_previous/next/last) computed
  items.len() - 1, panicking with an arithmetic underflow when the list was
  empty (e.g. a filter matched nothing). Index math is now in wrap-safe
  helpers that return no selection for an empty list.

- update_search_results overwrote the filtered results view with the full
  unfiltered list on every ~100ms poll, so an active filter silently stopped
  working as new results streamed in. It now re-derives the filtered view
  from the current query.

- The results pane rendered selection checkboxes by testing the display-row
  index against a selection set that stores unfiltered indices, so under an
  active filter the wrong rows showed as checked. It now maps the display
  index back through the filtered-index table.

Filtering and index-mapping logic extracted into pure, unit-tested helpers.
This commit is contained in:
michel
2026-07-18 14:30:02 +02:00
parent 16af88eb9d
commit bdaeb33a4f
4 changed files with 219 additions and 49 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
#[derive(Clone)]
#[derive(Clone, Default)]
pub struct FileDisplayData {
pub filename: String,
pub size: u64,