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:
@@ -1,4 +1,4 @@
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Default)]
|
||||
pub struct FileDisplayData {
|
||||
pub filename: String,
|
||||
pub size: u64,
|
||||
|
||||
Reference in New Issue
Block a user