refactor: clear the quality-scan findings

`render_shortcuts` was 144 lines of "which shortcuts apply" wrapped around 40
lines of drawing; the decision moves into a `shortcuts` method beside the
`rooms_shortcuts` helper that already worked this way. Three identically
shaped comments over the popup guards collapse into one that carries the part
worth knowing — an open popup owns the keyboard, so the order matters. The
state tests trade bare `unwrap()` for `expect()` so a failure names the step.
This commit is contained in:
Michel de Graaf
2026-07-25 02:32:11 +02:00
parent 14b0321dbc
commit 9d58bb9b64
3 changed files with 28 additions and 20 deletions
+8 -4
View File
@@ -298,8 +298,10 @@ impl MainTui {
}
}
fn render_shortcuts(&self, frame: &mut Frame, area: Rect) {
let shortcuts = if self.state.settings.is_some() {
/// Which shortcuts the bar offers, which is purely a question of what is
/// open and where the focus sits. Sibling of [`Self::rooms_shortcuts`].
fn shortcuts(&self) -> Vec<(&'static str, &'static str)> {
if self.state.settings.is_some() {
vec![
("↑↓", "move"),
("Enter/e", "edit download dir"),
@@ -399,9 +401,11 @@ impl MainTui {
]
}
}
};
}
}
let shortcuts_line = format_shortcuts_styled(&shortcuts);
fn render_shortcuts(&self, frame: &mut Frame, area: Rect) {
let shortcuts_line = format_shortcuts_styled(&self.shortcuts());
// Surface our own sharing status in the block title.
let shared = self.client.shared_directories();
let sharing = match shared.as_slice() {