1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2025-04-14 17:53:03 -04:00

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.
This commit is contained in:
Kirill Chibisov 2023-02-12 23:29:25 +03:00 committed by GitHub
parent b0195eb8b7
commit c82de4ccad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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');
}