diff --git a/src/command/cmd.rs b/src/command/cmd.rs index 48ecbba..fcfe11e 100644 --- a/src/command/cmd.rs +++ b/src/command/cmd.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use std::fmt::Debug; -use crossterm::event::{KeyCode, KeyModifiers}; +use crossterm::event::KeyCode; use crate::model::cell::CellValue; use crate::model::Model; @@ -19,7 +19,6 @@ pub struct CmdContext<'a> { pub search_query: &'a str, pub yanked: &'a Option, pub dirty: bool, - pub file_path_set: bool, pub search_mode: bool, pub formula_panel_open: bool, pub category_panel_open: bool, @@ -39,12 +38,14 @@ pub struct CmdContext<'a> { pub col_count: usize, /// The key that triggered this command pub key_code: KeyCode, - pub key_modifiers: KeyModifiers, } /// A command that reads state and produces effects. pub trait Cmd: Debug + Send + Sync { fn execute(&self, ctx: &CmdContext) -> Vec>; + /// The canonical name of this command (matches its registry key). + /// Used by the parser tests and for introspection. + #[allow(dead_code)] fn name(&self) -> &str; } @@ -135,6 +136,7 @@ impl CmdRegistry { Err(format!("Unknown command: {name}")) } + #[allow(dead_code)] pub fn names(&self) -> impl Iterator + '_ { self.entries.iter().map(|e| e.name) } @@ -2408,7 +2410,6 @@ mod tests { search_query: "", yanked: &None, dirty: false, - file_path_set: false, search_mode: false, formula_panel_open: false, category_panel_open: false, @@ -2422,7 +2423,6 @@ mod tests { row_count: layout.row_count(), col_count: layout.col_count(), key_code: KeyCode::Null, - key_modifiers: KeyModifiers::NONE, } } diff --git a/src/command/keymap.rs b/src/command/keymap.rs index 732f438..3b6ee53 100644 --- a/src/command/keymap.rs +++ b/src/command/keymap.rs @@ -193,10 +193,6 @@ impl KeymapSet { self.mode_maps.insert(mode, keymap); } - pub fn registry(&self) -> &CmdRegistry { - &self.registry - } - /// Dispatch a key event: returns effects if a binding matched. pub fn dispatch( &self, diff --git a/src/ui/app.rs b/src/ui/app.rs index cc208cc..8df93a2 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -100,7 +100,7 @@ impl App { } } - pub fn cmd_context(&self, key: KeyCode, mods: KeyModifiers) -> CmdContext<'_> { + pub fn cmd_context(&self, key: KeyCode, _mods: KeyModifiers) -> CmdContext<'_> { let view = self.model.active_view(); let layout = GridLayout::new(&self.model, view); let (sel_row, sel_col) = view.selected; @@ -113,7 +113,6 @@ impl App { search_query: &self.search_query, yanked: &self.yanked, dirty: self.dirty, - file_path_set: self.file_path.is_some(), search_mode: self.search_mode, formula_panel_open: self.formula_panel_open, category_panel_open: self.category_panel_open, @@ -127,7 +126,6 @@ impl App { row_count: layout.row_count(), col_count: layout.col_count(), key_code: key, - key_modifiers: mods, } }