Projects STRLCPY alacritty Commits c82de4cc
🤬
  • Don't send ESC for `OptionAsAlt::None`

    This doesn't solve issue for `RALT`/`LALT`, but that part is impossible
    until winit's keyboard v2 API.
  • Loading...
  • Kirill Chibisov committed with GitHub 1 year ago
    c82de4cc
    1 parent b0195eb8
  • ■ ■ ■ ■ ■
    alacritty/src/input.rs
    skipped 17 lines
    18 18  };
    19 19  use winit::event_loop::EventLoopWindowTarget;
    20 20  #[cfg(target_os = "macos")]
    21  -use winit::platform::macos::EventLoopWindowTargetExtMacOS;
     21 +use winit::platform::macos::{EventLoopWindowTargetExtMacOS, OptionAsAlt};
    22 22  use winit::window::CursorIcon;
    23 23   
    24 24  use alacritty_terminal::ansi::{ClearMode, Handler};
    skipped 843 lines
    868 868   let mut bytes = vec![0; utf8_len];
    869 869   c.encode_utf8(&mut bytes[..]);
    870 870   
    871  - if *self.ctx.received_count() == 0 && self.ctx.modifiers().alt() && utf8_len == 1 {
     871 + #[cfg(not(target_os = "macos"))]
     872 + let alt_send_esc = true;
     873 + 
     874 + // Don't send ESC when `OptionAsAlt` is used. This doesn't handle
     875 + // `Only{Left,Right}` variants due to inability to distinguish them.
     876 + #[cfg(target_os = "macos")]
     877 + let alt_send_esc = self.ctx.config().window.option_as_alt != OptionAsAlt::None;
     878 + 
     879 + if alt_send_esc
     880 + && *self.ctx.received_count() == 0
     881 + && self.ctx.modifiers().alt()
     882 + && utf8_len == 1
     883 + {
    872 884   bytes.insert(0, b'\x1b');
    873 885   }
    874 886   
    skipped 510 lines
Please wait...
Page is in error, reload to recover