From aa9d693dade93970308a43069269707b0c1c7bdb Mon Sep 17 00:00:00 2001 From: Mark Stosberg Date: Tue, 6 May 2025 08:08:37 -0400 Subject: [PATCH] feat: bind copy/paste keycodes to copy/paste actions. Required updating macro to support keycodes without modifiers. --- src/key_bind.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/key_bind.rs b/src/key_bind.rs index d5e3559..d8b37f4 100644 --- a/src/key_bind.rs +++ b/src/key_bind.rs @@ -9,10 +9,10 @@ pub fn key_binds() -> HashMap { let mut key_binds = HashMap::new(); macro_rules! bind { - ([$($modifier:ident),+ $(,)?], $key:expr, $action:ident) => {{ + ([$($modifier:ident),* $(,)?], $key:expr, $action:ident) => {{ key_binds.insert( KeyBind { - modifiers: vec![$(Modifier::$modifier),+], + modifiers: vec![$(Modifier::$modifier),*], key: $key, }, Action::$action, @@ -23,12 +23,14 @@ pub fn key_binds() -> HashMap { // Standard key bindings bind!([Ctrl, Shift], Key::Character("A".into()), SelectAll); bind!([Ctrl, Shift], Key::Character("C".into()), Copy); + bind!([], Key::Named(Named::Copy), Copy); bind!([Ctrl], Key::Character("c".into()), CopyOrSigint); bind!([Ctrl, Shift], Key::Character("F".into()), Find); bind!([Ctrl, Shift], Key::Character("N".into()), WindowNew); bind!([Ctrl, Shift], Key::Character("Q".into()), WindowClose); bind!([Ctrl, Shift], Key::Character("T".into()), TabNew); bind!([Ctrl, Shift], Key::Character("V".into()), Paste); + bind!([], Key::Named(Named::Paste), Paste); bind!([Shift], Key::Named(Named::Insert), PastePrimary); bind!([Ctrl, Shift], Key::Character("W".into()), TabClose); bind!([Ctrl], Key::Character(",".into()), Settings);