@@ -54,7 +54,7 @@ pub enum Type {
54
54
Array ( Rc < Type > ) ,
55
55
Struct ( Rc < Struct > ) ,
56
56
Enumeration ( Rc < Enumeration > ) ,
57
- KeyboardShortcut ,
57
+ KeyboardShortcutType ,
58
58
59
59
/// A type made up of the product of several "unit" types.
60
60
/// The first parameter is the unit, and the second parameter is the power.
@@ -102,7 +102,7 @@ impl core::cmp::PartialEq for Type {
102
102
matches ! ( other, Type :: Struct ( rhs) if lhs. fields == rhs. fields && lhs. name == rhs. name)
103
103
}
104
104
Type :: Enumeration ( lhs) => matches ! ( other, Type :: Enumeration ( rhs) if lhs == rhs) ,
105
- Type :: KeyboardShortcut => matches ! ( other, Type :: KeyboardShortcut ) ,
105
+ Type :: KeyboardShortcutType => matches ! ( other, Type :: KeyboardShortcutType ) ,
106
106
Type :: UnitProduct ( a) => matches ! ( other, Type :: UnitProduct ( b) if a == b) ,
107
107
Type :: ElementReference => matches ! ( other, Type :: ElementReference ) ,
108
108
Type :: LayoutCache => matches ! ( other, Type :: LayoutCache ) ,
@@ -162,7 +162,7 @@ impl Display for Type {
162
162
Type :: Easing => write ! ( f, "easing" ) ,
163
163
Type :: Brush => write ! ( f, "brush" ) ,
164
164
Type :: Enumeration ( enumeration) => write ! ( f, "enum {}" , enumeration. name) ,
165
- Type :: KeyboardShortcut => write ! ( f, "keyboard-shortcut" ) ,
165
+ Type :: KeyboardShortcutType => write ! ( f, "keyboard-shortcut" ) ,
166
166
Type :: UnitProduct ( vec) => {
167
167
const POWERS : & [ char ] = & [ '⁰' , '¹' , '²' , '³' , '⁴' , '⁵' , '⁶' , '⁷' , '⁸' , '⁹' ] ;
168
168
let mut x = vec. iter ( ) . map ( |( unit, power) | {
@@ -211,7 +211,7 @@ impl Type {
211
211
| Self :: Bool
212
212
| Self :: Easing
213
213
| Self :: Enumeration ( _)
214
- | Self :: KeyboardShortcut
214
+ | Self :: KeyboardShortcutType
215
215
| Self :: ElementReference
216
216
| Self :: Struct { .. }
217
217
| Self :: Array ( _)
@@ -315,7 +315,7 @@ impl Type {
315
315
Type :: Array ( _) => None ,
316
316
Type :: Struct { .. } => None ,
317
317
Type :: Enumeration ( _) => None ,
318
- Type :: KeyboardShortcut => None ,
318
+ Type :: KeyboardShortcutType => None ,
319
319
Type :: UnitProduct ( _) => None ,
320
320
Type :: ElementReference => None ,
321
321
Type :: LayoutCache => None ,
@@ -866,18 +866,18 @@ impl PartialEq for KeyboardShortcut {
866
866
867
867
impl std:: fmt:: Display for KeyboardShortcut {
868
868
fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
869
- let alt = if self . modifiers . alt { "Alt+" } else { "" } ;
870
- let ctrl = if self . modifiers . control { "Control+" } else { "" } ;
871
- let meta = if self . modifiers . meta { "Meta+" } else { "" } ;
872
- let shift = if self . modifiers . shift { "shift+" } else { "" } ;
873
- write ! ( f, "{alt}{ctrl}{meta}{shift}{}" , self . key)
869
+ if self . key . is_empty ( ) {
870
+ write ! ( f, "" )
871
+ } else {
872
+ let alt = if self . modifiers . alt { "Alt+" } else { "" } ;
873
+ let ctrl = if self . modifiers . control { "Control+" } else { "" } ;
874
+ let meta = if self . modifiers . meta { "Meta+" } else { "" } ;
875
+ let shift = if self . modifiers . shift { "shift+" } else { "" } ;
876
+ write ! ( f, "{alt}{ctrl}{meta}{shift}{}" , self . key)
877
+ }
874
878
}
875
879
}
876
880
877
- pub fn keyboard_shortcuts_to_string ( shortcuts : & [ KeyboardShortcut ] ) -> String {
878
- shortcuts. iter ( ) . map ( |ks| ks. to_string ( ) ) . join ( ", " )
879
- }
880
-
881
881
#[ derive( Clone , Debug ) ]
882
882
pub struct EnumerationValue {
883
883
pub value : usize , // index in enumeration.values
0 commit comments