feat(input): add editable shortcut table

Persist all active bindings and route keyboard events through the configured table.\n\nRefs #449
This commit is contained in:
Hakan Seven 2026-08-04 15:35:06 +03:00
commit 2f86bfde8e
9 changed files with 445 additions and 334 deletions

View file

@ -36,6 +36,8 @@ pub struct AppConfig {
/// Print dialog preferences (only the persisted fields; runtime state is
/// skipped by `PlotDialogState`'s serde attributes).
pub plot: PlotDialogState,
/// Complete editable keyboard shortcut table.
pub shortcuts: ShortcutConfig,
}
impl Default for AppConfig {
@ -50,6 +52,21 @@ impl Default for AppConfig {
annotation_auto_scale: -4,
ribbon: RibbonConfig::default(),
plot: PlotDialogState::default(),
shortcuts: ShortcutConfig::default(),
}
}
}
#[derive(Clone, PartialEq, Serialize, Deserialize)]
#[serde(default)]
pub struct ShortcutConfig {
pub bindings: std::collections::BTreeMap<String, String>,
}
impl Default for ShortcutConfig {
fn default() -> Self {
Self {
bindings: super::shortcuts::default_bindings(),
}
}
}