refactor(tui): one page window and one filter editor for every list
Four panes had grown the same dance around ratatui's table: clamp the selection, take the visible page, hand the table a page-local state, keep the page start. It is now page_window and render_page in a paging module beside page_of, and the two popups page by the same count they draw, tab bar or header included. Five typed filters had grown the same key handling too. edit_filter now takes a key for all of them, which also stops a control or alt chord from typing its letter into a filter, stops Enter, which keeps a filter, from resetting the view it is over, and lets the results and room-list filters page like the others. Their titles and the typing shortcuts come from one place as well.
This commit is contained in:
@@ -1738,6 +1738,12 @@ mod tests {
|
||||
assert_eq!(rows(&tui), 3, "music, alpha, a2.flac");
|
||||
let screen = screen_of(&mut tui);
|
||||
assert!(screen.contains("filter: flac_"), "{screen}");
|
||||
ctrl(&mut tui, 'd');
|
||||
assert_eq!(
|
||||
tui.state.browse.active_tab().expect("tab").filter(),
|
||||
"flac",
|
||||
"a control chord pages, it does not type"
|
||||
);
|
||||
press(&mut tui, KeyCode::Enter);
|
||||
press(&mut tui, KeyCode::Char('j'));
|
||||
press(&mut tui, KeyCode::Char('j'));
|
||||
@@ -1775,6 +1781,8 @@ mod tests {
|
||||
assert!(screen.contains("line 010"), "{screen}");
|
||||
assert!(!screen.contains("line 029"), "{screen}");
|
||||
assert!(screen.contains("filter: line 01_"), "{screen}");
|
||||
ctrl(&mut tui, 'u');
|
||||
assert_eq!(tui.state.rooms.log_filter, "line 01", "^u scrolls");
|
||||
press(&mut tui, KeyCode::Enter);
|
||||
press(&mut tui, KeyCode::Esc);
|
||||
assert!(tui.state.rooms.log_filter.is_empty());
|
||||
|
||||
Reference in New Issue
Block a user