summaryrefslogtreecommitdiffstats
path: root/src/key_command
diff options
context:
space:
mode:
authorJeff Zhao <jeff.no.zhao@gmail.com>2023-08-29 10:16:53 -0400
committerJeff Zhao <jeff.no.zhao@gmail.com>2023-08-29 10:16:53 -0400
commit31beaabe6b2cf4119aacae6c1722cdc1e5ba2f5b (patch)
tree095ec193999ac9ad3494a2abf039ff1dc7da00d2 /src/key_command
parent40ab1b0125c86b6554f2a23d90053c805d7a857a (diff)
command chaining support
- breaks existing keymap configs -`command` field is renamed to `commands` - now an array instead of a single string
Diffstat (limited to 'src/key_command')
-rw-r--r--src/key_command/command_keybind.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/key_command/command_keybind.rs b/src/key_command/command_keybind.rs
index 97e5de3..522458b 100644
--- a/src/key_command/command_keybind.rs
+++ b/src/key_command/command_keybind.rs
@@ -4,7 +4,7 @@ use crate::key_command::Command;
#[derive(Debug)]
pub enum CommandKeybind {
SimpleKeybind {
- command: Command,
+ commands: Vec<Command>,
description: Option<String>,
},
CompositeKeybind(KeyMapping),
@@ -14,13 +14,18 @@ impl std::fmt::Display for CommandKeybind {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
CommandKeybind::SimpleKeybind {
- command: _,
+ commands: _,
description: Some(desc),
} => write!(f, "{}", desc),
CommandKeybind::SimpleKeybind {
- command: cmd,
+ commands,
description: None,
- } => write!(f, "{}", cmd),
+ } => {
+ for cmd in commands {
+ write!(f, "{}, ", cmd)?;
+ }
+ Ok(())
+ }
CommandKeybind::CompositeKeybind(_) => write!(f, "..."),
}
}