diff options
author | noyez <noyez@ithryn.net> | 2022-11-02 11:39:56 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-02 16:39:56 +0100 |
commit | c8f3b94fde65c1c923897947aff6daa9d2045ae9 (patch) | |
tree | 9bdc4439563ec05ac296b1649621a922bceef1e3 | |
parent | 4ab04c59a246e5ddea9fe8cb36379073c07c219f (diff) |
fix(converter): YAML => KDL conversion with backslash hotkey. (#1879)
* Fixing YAML => KDL conversion with backslash hotkey.
Previously if the hotkey of backslash was used the yaml => kdl
conversion would create a KDL statement like so: `bind "\" {...}`.
That is incorrect kdl syntax since the backslash escapes the following
quote character. A way to get proper KDL is `bind r"\" {...}`. This
commit changes if the old HotKey is a backslash a properly creates KDL
syntax to address the backslash character.
* rustfmt
-rw-r--r-- | zellij-client/src/old_config_converter/old_config.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/zellij-client/src/old_config_converter/old_config.rs b/zellij-client/src/old_config_converter/old_config.rs index 73e098b7d..bfe345dfc 100644 --- a/zellij-client/src/old_config_converter/old_config.rs +++ b/zellij-client/src/old_config_converter/old_config.rs @@ -424,7 +424,13 @@ fn keybinds_yaml_to_keybinds_kdl(keybinds_yaml: &OldKeybindsFromYaml) -> String let actions = &key_action.action; let key_string: String = keys .iter() - .map(|k| format!("\"{}\"", k)) + .map(|k| { + if k == &OldKey::Char('\\') { + format!("r\"{}\"", k) + } else { + format!("\"{}\"", k) + } + }) .collect::<Vec<String>>() .join(" "); let actions_string: String = actions |