feat(tui): scroll long result names and page through results

Closes #55.

While [2] Results is focused the Info pane describes the highlighted
result, so a truncated path can be read in full. h/l (or the arrow keys)
scroll the filename column by display cells, 0 and $ jump to either end
of the highlighted name, and Home/End, g/G, PgUp/PgDn and Ctrl-f/b/d/u
move through the list; the same keys work while a filter is being typed.

Ctrl chords are no longer read as their bare letter: outside [2] they do
nothing, where before Ctrl-d deleted a search and Ctrl-c opened rooms.
Space after a filter that matches nothing no longer indexes an empty
list.
This commit is contained in:
Michel de Graaf
2026-09-06 20:10:59 +02:00
parent 7bc696cab6
commit 3193c73f5b
12 changed files with 577 additions and 117 deletions
+18 -8
View File
@@ -1,7 +1,7 @@
use super::MainTui;
use crate::models::{CommandBarMode, FocusedPane, RoomsView};
use crate::ui::panes::{
ResultsPaneParams, render_browse_pane, render_chat_pane,
InfoSubject, ResultsPaneParams, render_browse_pane, render_chat_pane,
render_download_info_pane, render_downloads_pane, render_results_pane,
render_rooms_pane, render_searches_pane, selected_transfer,
};
@@ -120,6 +120,7 @@ impl MainTui {
is_filtering: self.state.results_is_filtering,
focused: self.state.focused_pane == FocusedPane::Results,
active_search_query,
name_offset: self.state.results_name_offset,
},
);
@@ -132,16 +133,23 @@ impl MainTui {
self.state.focused_pane == FocusedPane::Downloads,
);
let selected_transfer = selected_transfer(
self.state.downloads_table_state.selected(),
&self.state.downloads,
&self.state.uploads,
);
let selected = if self.state.focused_pane == FocusedPane::Results {
self.highlighted_result().map(InfoSubject::Result)
} else {
selected_transfer(
self.state.downloads_table_state.selected(),
&self.state.downloads,
&self.state.uploads,
)
};
render_download_info_pane(
frame,
downloads_chunks[1],
selected_transfer,
self.state.focused_pane == FocusedPane::Downloads,
selected,
matches!(
self.state.focused_pane,
FocusedPane::Results | FocusedPane::Downloads
),
);
}
@@ -386,6 +394,8 @@ impl MainTui {
("c", "chat"),
("/", "filter"),
("a/A", "select all/none"),
("h/l", "scroll"),
("g/G", "top/end"),
("1-3", "focus pane"),
("q", "quit"),
],