From 2bfa86f0cd61ed887f626854c56cea518cf62a89 Mon Sep 17 00:00:00 2001 From: Daniel Cardona Rojas Date: Mon, 31 Aug 2026 10:47:54 -0500 Subject: [PATCH 1/2] Let 'q' quit the TUI while settings/keybindings overlays are open Both modal overlays previously swallowed every key, trapping the user so 'q' did nothing. Add a 'q' branch to each that calls state.quit() before the existing modal handling, mirroring the global Ctrl+C escape hatch. All other keys still route to the overlays unchanged. Co-Authored-By: Claude Opus 4.8 --- crates/codemark-tui/src/entry.rs | 50 +++++++++++++++++++------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/crates/codemark-tui/src/entry.rs b/crates/codemark-tui/src/entry.rs index b2141219..e8a65fe7 100644 --- a/crates/codemark-tui/src/entry.rs +++ b/crates/codemark-tui/src/entry.rs @@ -275,7 +275,11 @@ async fn run_app() -> Result> { AppMode::Normal if show_keys => { // The keybindings cheat sheet is modal: it // swallows every key; Esc or `?` closes it. - if matches!( + // `q` still quits (global escape hatch) so the + // overlay doesn't trap the user. + if key.code == event::KeyCode::Char('q') { + state.quit(); + } else if matches!( key.code, event::KeyCode::Esc | event::KeyCode::Char('?') ) { @@ -284,27 +288,33 @@ async fn run_app() -> Result> { handled = true; } AppMode::Normal if settings.is_visible() => { - // The settings overlay is modal: it swallows - // every key (tab switching, Esc/`,` to close). - let config = layout.config_info(); - match settings.handle_key(key.code, &config) { - crate::settings::SettingsAction::ThemeChanged => { - // Re-highlight existing previews with the - // newly applied theme (the chrome updates - // automatically on the next render). - layout.reapply_preview_theme(); - handled = true; - } - crate::settings::SettingsAction::Notify(msg) => { - notification = - Some((msg, NotificationType::Error, Instant::now())); - handled = true; - } - crate::settings::SettingsAction::Handled - | crate::settings::SettingsAction::Unhandled => { - handled = true; // Still modal, so swallow + // The settings overlay is modal, but `q` still + // quits (global escape hatch) so it doesn't trap + // the user; every other key is swallowed (tab + // switching, Esc/`,` to close). + if key.code == event::KeyCode::Char('q') { + state.quit(); + } else { + let config = layout.config_info(); + match settings.handle_key(key.code, &config) { + crate::settings::SettingsAction::ThemeChanged => { + // Re-highlight existing previews with the + // newly applied theme (the chrome updates + // automatically on the next render). + layout.reapply_preview_theme(); + } + crate::settings::SettingsAction::Notify(msg) => { + notification = Some(( + msg, + NotificationType::Error, + Instant::now(), + )); + } + crate::settings::SettingsAction::Handled + | crate::settings::SettingsAction::Unhandled => {} } } + handled = true; } AppMode::Normal => { // Handle global key bindings (disabled when Search is focused). From dadc6be4ca304673c9efa841693ea1687f63e9f8 Mon Sep 17 00:00:00 2001 From: Daniel Cardona Rojas Date: Mon, 31 Aug 2026 11:31:49 -0500 Subject: [PATCH 2/2] Fix clippy chunks_exact_to_as_chunks lint in vec_store Use `as_chunks::<4>()` instead of `chunks_exact(4)` when parsing the embedding blob into f32s, satisfying `cargo clippy -- -D warnings`. Co-Authored-By: Claude Opus 4.8 --- crates/codemark-core/src/embeddings/vec_store.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/codemark-core/src/embeddings/vec_store.rs b/crates/codemark-core/src/embeddings/vec_store.rs index 09611707..80c5f94b 100644 --- a/crates/codemark-core/src/embeddings/vec_store.rs +++ b/crates/codemark-core/src/embeddings/vec_store.rs @@ -221,8 +221,7 @@ impl VecStore { // Parse as f32 array let mut embedding = Vec::with_capacity(blob.len() / 4); - for chunk in blob.chunks_exact(4) { - let bytes: [u8; 4] = [chunk[0], chunk[1], chunk[2], chunk[3]]; + for &bytes in blob.as_chunks::<4>().0 { embedding.push(f32::from_le_bytes(bytes)); } Ok(embedding)