Fix bug in keyboard shortcut formatting
This commit is contained in:
parent
c5e6def65e
commit
a3f1e5961f
1 changed files with 16 additions and 1 deletions
|
@ -546,7 +546,7 @@ impl<'a> ModifierNames<'a> {
|
||||||
append_if(modifiers.alt, self.alt);
|
append_if(modifiers.alt, self.alt);
|
||||||
append_if(modifiers.mac_cmd || modifiers.command, self.mac_cmd);
|
append_if(modifiers.mac_cmd || modifiers.command, self.mac_cmd);
|
||||||
} else {
|
} else {
|
||||||
append_if(modifiers.ctrl, self.ctrl);
|
append_if(modifiers.ctrl || modifiers.command, self.ctrl);
|
||||||
append_if(modifiers.alt, self.alt);
|
append_if(modifiers.alt, self.alt);
|
||||||
append_if(modifiers.shift, self.shift);
|
append_if(modifiers.shift, self.shift);
|
||||||
}
|
}
|
||||||
|
@ -789,6 +789,21 @@ impl KeyboardShortcut {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn format_kb_shortcut() {
|
||||||
|
let cmd_shift_f = KeyboardShortcut::new(Modifiers::COMMAND | Modifiers::SHIFT, Key::F);
|
||||||
|
assert_eq!(
|
||||||
|
cmd_shift_f.format(&ModifierNames::NAMES, false),
|
||||||
|
"Ctrl+Shift+F"
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
cmd_shift_f.format(&ModifierNames::NAMES, true),
|
||||||
|
"Shift+Cmd+F"
|
||||||
|
);
|
||||||
|
assert_eq!(cmd_shift_f.format(&ModifierNames::SYMBOLS, false), "^⇧F");
|
||||||
|
assert_eq!(cmd_shift_f.format(&ModifierNames::SYMBOLS, true), "⇧⌘F");
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
impl RawInput {
|
impl RawInput {
|
||||||
|
|
Loading…
Reference in a new issue