diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2023-02-12 23:29:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-12 23:29:25 +0300 |
commit | c82de4ccadcaf2e74dc8e8ef2da1ebe13e2ca5a9 (patch) | |
tree | 068210f082180f9739c9a796622941b537fb50e3 | |
parent | b0195eb8b74b1566a0c8b9bf65af644439497a7b (diff) | |
download | alacritty-c82de4ccadcaf2e74dc8e8ef2da1ebe13e2ca5a9.tar.gz alacritty-c82de4ccadcaf2e74dc8e8ef2da1ebe13e2ca5a9.zip |
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.
-rw-r--r-- | alacritty/src/input.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs index d27a8ca7..d454746a 100644 --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -18,7 +18,7 @@ use winit::event::{ }; use winit::event_loop::EventLoopWindowTarget; #[cfg(target_os = "macos")] -use winit::platform::macos::EventLoopWindowTargetExtMacOS; +use winit::platform::macos::{EventLoopWindowTargetExtMacOS, OptionAsAlt}; use winit::window::CursorIcon; use alacritty_terminal::ansi::{ClearMode, Handler}; @@ -868,7 +868,19 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> { let mut bytes = vec![0; utf8_len]; c.encode_utf8(&mut bytes[..]); - if *self.ctx.received_count() == 0 && self.ctx.modifiers().alt() && utf8_len == 1 { + #[cfg(not(target_os = "macos"))] + let alt_send_esc = true; + + // Don't send ESC when `OptionAsAlt` is used. This doesn't handle + // `Only{Left,Right}` variants due to inability to distinguish them. + #[cfg(target_os = "macos")] + let alt_send_esc = self.ctx.config().window.option_as_alt != OptionAsAlt::None; + + if alt_send_esc + && *self.ctx.received_count() == 0 + && self.ctx.modifiers().alt() + && utf8_len == 1 + { bytes.insert(0, b'\x1b'); } |