diff --git a/flake.nix b/flake.nix index 6f092bd..70f37c1 100644 --- a/flake.nix +++ b/flake.nix @@ -142,5 +142,10 @@ ''; }; } - ); + ) + // { + herculesCI = { + onPush = { }; + }; + }; } diff --git a/rust/src/tui/app.rs b/rust/src/tui/app.rs index 9db4dff..47d6fdd 100644 --- a/rust/src/tui/app.rs +++ b/rust/src/tui/app.rs @@ -153,6 +153,14 @@ impl App { } } + if self + .keymap + .action_for_key_in(&key, &[KeyAction::Help]) + .is_some() + { + return self.run_keymap_action(KeyAction::Help); + } + // ── Single-key fallthrough (no active chord) ────────────────── match &mut self.view { View::Search(search) => { diff --git a/rust/src/tui/harness.rs b/rust/src/tui/harness.rs index 41c9d0b..486188d 100644 --- a/rust/src/tui/harness.rs +++ b/rust/src/tui/harness.rs @@ -563,6 +563,26 @@ mod tests { ); } + #[test] + fn default_keymap_question_mark_opens_search_help() { + let fx = Fixture::new(); + let mut h = TuiHarness::with_keymap(&fx.ctx, 120, 30, KeyMap::default()); + assert_eq!(h.app.current_view(), "search"); + + h.press(KeyCode::Char('?')); + + assert!( + h.contains("filter results"), + "question mark should open search help, not filter text:\n{}", + h.rendered() + ); + assert!( + !h.contains("no matches"), + "question mark was treated as search input:\n{}", + h.rendered() + ); + } + /// A user who rebinds `new_secret` to `F2` should be able to press F2 /// and land in the new-secret form — and the former default (Ctrl+N) /// must stop working, proving the override fully replaces that action. diff --git a/rust/src/tui/views/envs_dsl_editor.rs b/rust/src/tui/views/envs_dsl_editor.rs index 49163d4..58bdfa0 100644 --- a/rust/src/tui/views/envs_dsl_editor.rs +++ b/rust/src/tui/views/envs_dsl_editor.rs @@ -215,7 +215,7 @@ fn fuzzy_top(corpus: &[String], pattern_str: &str, n: usize) -> Vec { pattern.score(h, &mut matcher).map(|s| (s, c.clone())) }) .collect(); - scored.sort_by(|a, b| b.0.cmp(&a.0)); + scored.sort_by_key(|item| std::cmp::Reverse(item.0)); scored.into_iter().take(n).map(|(_, s)| s).collect() } diff --git a/rust/src/tui/views/init_wizard.rs b/rust/src/tui/views/init_wizard.rs index e790adc..d9c6ed4 100644 --- a/rust/src/tui/views/init_wizard.rs +++ b/rust/src/tui/views/init_wizard.rs @@ -275,15 +275,13 @@ impl InitWizardView { _ => {} }, Step::Provider => match key.code { - KeyCode::Up | KeyCode::Char('k') => { - if self.provider_index > 0 { - self.provider_index -= 1; - } + KeyCode::Up | KeyCode::Char('k') if self.provider_index > 0 => { + self.provider_index -= 1; } - KeyCode::Down | KeyCode::Char('j') => { - if self.provider_index + 1 < self.provider_options.len() { - self.provider_index += 1; - } + KeyCode::Down | KeyCode::Char('j') + if self.provider_index + 1 < self.provider_options.len() => + { + self.provider_index += 1; } KeyCode::Enter => self.begin_init(), KeyCode::Esc => {