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
+23
View File
@@ -100,6 +100,28 @@ impl MainTui {
self.state.results_table_state.select(None);
self.state.results_filter_query.clear();
self.state.results_is_filtering = false;
self.state.results_name_offset = 0;
}
pub(super) fn visible_results(&self) -> &[FileDisplayData] {
if self.state.results_filter_query.is_empty() {
&self.state.results_items
} else {
&self.state.results_filtered_items
}
}
pub(super) fn highlighted_result(&self) -> Option<&FileDisplayData> {
self.visible_results()
.get(self.state.results_table_state.selected()?)
}
pub(super) fn original_index(&self, row: usize) -> Option<usize> {
if self.state.results_filter_query.is_empty() {
Some(row)
} else {
self.state.results_filtered_indices.get(row).copied()
}
}
pub(super) fn apply_filter(&mut self) {
@@ -207,6 +229,7 @@ impl MainTui {
self.state.results_filtered_indices.clear();
self.state.results_selected_indices.clear();
self.state.results_table_state.select(Some(0));
self.state.results_name_offset = 0;
// Switch focus to Results pane
self.state.focused_pane = FocusedPane::Results;