File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -26,17 +26,29 @@ pub async fn client_main(
2626
2727 defer ! ( disable_raw_mode( ) . log_ignore( ) ) ;
2828
29+ // If xterm modifyOtherKeys is enabled in iTerm2 then Ctrl prefixed key
30+ // presses are not captured. That is while using crossterm.
31+ // But termwiz works well, even though it seems to be using modifyOtherKeys
32+ // also.
33+ let ( otherkeys_on, otherkeys_off) =
34+ if std:: env:: var ( "TERM_PROGRAM" ) . unwrap_or_default ( ) == "iTerm.app" {
35+ ( "" , "" )
36+ } else {
37+ ( "\x1b [>4;2m" , "\x1b [>4;0m" )
38+ } ;
39+
2940 execute ! (
3041 std:: io:: stdout( ) ,
3142 EnterAlternateScreen ,
3243 Clear ( ClearType :: All ) ,
3344 EnableMouseCapture ,
3445 // https://wezfurlong.org/wezterm/config/key-encoding.html#xterm-modifyotherkeys
35- crossterm:: style:: Print ( " \x1b [>4;2m" ) ,
46+ crossterm:: style:: Print ( otherkeys_on ) ,
3647 ) ?;
3748
3849 defer ! ( execute!(
3950 std:: io:: stdout( ) ,
51+ crossterm:: style:: Print ( otherkeys_off) ,
4052 DisableMouseCapture ,
4153 LeaveAlternateScreen
4254 )
You can’t perform that action at this time.
0 commit comments