File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
codex-rs/tui/src/bottom_pane Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -247,6 +247,16 @@ impl TextArea {
247247 } if modifiers == ( KeyModifiers :: CONTROL | KeyModifiers :: ALT ) => {
248248 self . delete_backward_word ( )
249249 } ,
250+ KeyEvent {
251+ code : KeyCode :: Char ( c) ,
252+ modifiers,
253+ ..
254+ } if modifiers. contains ( KeyModifiers :: ALT )
255+ && modifiers. contains ( KeyModifiers :: CONTROL ) =>
256+ {
257+ // AltGr on many keyboards reports as Ctrl+Alt; treat it as a literal char.
258+ self . insert_str ( & c. to_string ( ) ) ;
259+ }
250260 KeyEvent {
251261 code : KeyCode :: Backspace ,
252262 modifiers : KeyModifiers :: ALT ,
@@ -1454,6 +1464,17 @@ mod tests {
14541464 assert_eq ! ( t. cursor( ) , 3 ) ;
14551465 }
14561466
1467+ #[ test]
1468+ fn altgr_ctrl_alt_char_inserts_literal ( ) {
1469+ let mut t = ta_with ( "" ) ;
1470+ t. input ( KeyEvent :: new (
1471+ KeyCode :: Char ( 'c' ) ,
1472+ KeyModifiers :: CONTROL | KeyModifiers :: ALT ,
1473+ ) ) ;
1474+ assert_eq ! ( t. text( ) , "c" ) ;
1475+ assert_eq ! ( t. cursor( ) , 1 ) ;
1476+ }
1477+
14571478 #[ test]
14581479 fn cursor_vertical_movement_across_lines_and_bounds ( ) {
14591480 let mut t = ta_with ( "short\n loooooooooong\n mid" ) ;
You can’t perform that action at this time.
0 commit comments