@@ -3314,8 +3314,46 @@ impl<'a> Context<'a, '_> {
33143314 }
33153315
33163316 fn menubar_shortcut ( & mut self , shortcut : InputKey ) {
3317- let shortcut_letter = shortcut. value ( ) as u8 as char ;
3318- if shortcut_letter. is_ascii_uppercase ( ) {
3317+ let shortcut_key = shortcut. key ( ) . value ( ) ;
3318+ let shortcut_letter = shortcut_key as u8 as char ;
3319+
3320+ // Check if it's a displayable shortcut (letter, function key, or special key)
3321+ let key_name: Option < & str > = if shortcut_letter. is_ascii_uppercase ( ) {
3322+ None // Will use the letter directly
3323+ } else {
3324+ match shortcut_key {
3325+ // Arrow keys
3326+ 0x25 => Some ( "←" ) ,
3327+ 0x26 => Some ( "↑" ) ,
3328+ 0x27 => Some ( "→" ) ,
3329+ 0x28 => Some ( "↓" ) ,
3330+ // Function keys
3331+ 0x70 => Some ( "F1" ) ,
3332+ 0x71 => Some ( "F2" ) ,
3333+ 0x72 => Some ( "F3" ) ,
3334+ 0x73 => Some ( "F4" ) ,
3335+ 0x74 => Some ( "F5" ) ,
3336+ 0x75 => Some ( "F6" ) ,
3337+ 0x76 => Some ( "F7" ) ,
3338+ 0x77 => Some ( "F8" ) ,
3339+ 0x78 => Some ( "F9" ) ,
3340+ 0x79 => Some ( "F10" ) ,
3341+ 0x7A => Some ( "F11" ) ,
3342+ 0x7B => Some ( "F12" ) ,
3343+ // Other special keys
3344+ 0x21 => Some ( "PgUp" ) ,
3345+ 0x22 => Some ( "PgDn" ) ,
3346+ 0x23 => Some ( "End" ) ,
3347+ 0x24 => Some ( "Home" ) ,
3348+ 0x2D => Some ( "Ins" ) ,
3349+ 0x2E => Some ( "Del" ) ,
3350+ 0x1B => Some ( "Esc" ) ,
3351+ 0x5C => Some ( "\\ " ) , // Backslash
3352+ _ => None ,
3353+ }
3354+ } ;
3355+
3356+ if shortcut_letter. is_ascii_uppercase ( ) || key_name. is_some ( ) {
33193357 let mut shortcut_text = ArenaString :: new_in ( self . arena ( ) ) ;
33203358 if shortcut. modifiers_contains ( kbmod:: CTRL ) {
33213359 shortcut_text. push_str ( self . tui . modifier_translations . ctrl ) ;
@@ -3329,7 +3367,11 @@ impl<'a> Context<'a, '_> {
33293367 shortcut_text. push_str ( self . tui . modifier_translations . shift ) ;
33303368 shortcut_text. push ( '+' ) ;
33313369 }
3332- shortcut_text. push ( shortcut_letter) ;
3370+ if let Some ( name) = key_name {
3371+ shortcut_text. push_str ( name) ;
3372+ } else {
3373+ shortcut_text. push ( shortcut_letter) ;
3374+ }
33333375
33343376 self . label ( "shortcut" , & shortcut_text) ;
33353377 } else {
0 commit comments