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
This commit is contained in:
parent
4ab04c59a2
commit
c8f3b94fde
1 changed files with 7 additions and 1 deletions
|
|
@ -424,7 +424,13 @@ fn keybinds_yaml_to_keybinds_kdl(keybinds_yaml: &OldKeybindsFromYaml) -> String
|
||||||
let actions = &key_action.action;
|
let actions = &key_action.action;
|
||||||
let key_string: String = keys
|
let key_string: String = keys
|
||||||
.iter()
|
.iter()
|
||||||
.map(|k| format!("\"{}\"", k))
|
.map(|k| {
|
||||||
|
if k == &OldKey::Char('\\') {
|
||||||
|
format!("r\"{}\"", k)
|
||||||
|
} else {
|
||||||
|
format!("\"{}\"", k)
|
||||||
|
}
|
||||||
|
})
|
||||||
.collect::<Vec<String>>()
|
.collect::<Vec<String>>()
|
||||||
.join(" ");
|
.join(" ");
|
||||||
let actions_string: String = actions
|
let actions_string: String = actions
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue