@@ -400,11 +400,18 @@ impl From<&ForgeCommandManager> for Info {
400400 info = info. add_key_value ( command. name , command. description ) ;
401401 }
402402
403+ // Use compile-time OS detection for keyboard shortcuts
404+ #[ cfg( target_os = "macos" ) ]
405+ let multiline_shortcut = "<OPT+ENTER>" ;
406+
407+ #[ cfg( not( target_os = "macos" ) ) ]
408+ let multiline_shortcut = "<ALT+ENTER>" ;
409+
403410 info = info
404411 . add_title ( "KEYBOARD SHORTCUTS" )
405412 . add_key_value ( "<CTRL+C>" , "Interrupt current operation" )
406413 . add_key_value ( "<CTRL+D>" , "Quit Forge interactive shell" )
407- . add_key_value ( "<OPT+ENTER>" , "Insert new line (multiline input)" ) ;
414+ . add_key_value ( multiline_shortcut , "Insert new line (multiline input)" ) ;
408415
409416 info
410417 }
@@ -934,4 +941,30 @@ mod tests {
934941 "SECTION ONE should have wider padding than SECTION TWO"
935942 ) ;
936943 }
944+
945+ #[ test]
946+ fn test_info_from_command_manager ( ) {
947+ let command_manager = super :: ForgeCommandManager :: default ( ) ;
948+ let info = super :: Info :: from ( & command_manager) ;
949+ let display = info. to_string ( ) ;
950+
951+ // Verify compile-time detection works correctly
952+ #[ cfg( target_os = "macos" ) ]
953+ {
954+ assert ! ( display. contains( "<OPT+ENTER>" ) ) ;
955+ assert ! ( !display. contains( "<ALT+ENTER>" ) ) ;
956+ }
957+
958+ #[ cfg( not( target_os = "macos" ) ) ]
959+ {
960+ assert ! ( display. contains( "<ALT+ENTER>" ) ) ;
961+ assert ! ( !display. contains( "<OPT+ENTER>" ) ) ;
962+ }
963+
964+ // Should contain standard sections
965+ assert ! ( display. contains( "COMMANDS" ) ) ;
966+ assert ! ( display. contains( "KEYBOARD SHORTCUTS" ) ) ;
967+ assert ! ( display. contains( "<CTRL+C>" ) ) ;
968+ assert ! ( display. contains( "<CTRL+D>" ) ) ;
969+ }
937970}
0 commit comments