Skip to content

Commit

Permalink
fix(converter): YAML => KDL conversion with backslash hotkey. (#1879)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
noyez authored Nov 2, 2022
1 parent 4ab04c5 commit c8f3b94
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion zellij-client/src/old_config_converter/old_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c8f3b94

Please sign in to comment.