From c8f3b94fde65c1c923897947aff6daa9d2045ae9 Mon Sep 17 00:00:00 2001 From: noyez Date: Wed, 2 Nov 2022 11:39:56 -0400 Subject: [PATCH] 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 --- zellij-client/src/old_config_converter/old_config.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zellij-client/src/old_config_converter/old_config.rs b/zellij-client/src/old_config_converter/old_config.rs index 73e098b7..bfe345df 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::>() .join(" "); let actions_string: String = actions