mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 01:16:18 +04:00
Disallow macro keybindings within command sequences
This is a temporary limitation because of the way that command sequences are executed. Each command is currently executed back-to-back synchronously, but macros are by design queued up for the compositor. So macros mixed into a command sequence will behave undesirably: they will be executed after the rest of the static and/or typable commands in the sequence. This is pending a larger refactor of how we handle commands. <https://redirect.github.com/helix-editor/helix/issues/5555> has further details and <https://redirect.github.com/helix-editor/helix/issues/4508> discusses a similar problem faced by the command palette.
This commit is contained in:
parent
1098a348aa
commit
b7820ee668
@ -177,6 +177,19 @@ fn visit_seq<S>(self, mut seq: S) -> Result<Self::Value, S::Error>
|
||||
.map_err(serde::de::Error::custom)?,
|
||||
)
|
||||
}
|
||||
|
||||
// Prevent macro keybindings from being used in command sequences.
|
||||
// This is meant to be a temporary restriction pending a larger
|
||||
// refactor of how command sequences are executed.
|
||||
if commands
|
||||
.iter()
|
||||
.any(|cmd| matches!(cmd, MappableCommand::Macro { .. }))
|
||||
{
|
||||
return Err(serde::de::Error::custom(
|
||||
"macro keybindings may not be used in command sequences",
|
||||
));
|
||||
}
|
||||
|
||||
Ok(KeyTrie::Sequence(commands))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user