From b625c566b148dfa0ba39ace268bad9e2616ee1af Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Thu, 17 Oct 2024 11:14:14 +0200 Subject: [PATCH] Remove workaround for WezTerm configured with enable_kitty_keyboard=true On a German keyboard, with a German keymap, and this ~/.wezterm.lua local wezterm = require 'wezterm' local config = wezterm.config_builder() config.enable_kitty_keyboard = true return config when I press shift+# (which is single quote) WezTerm sends the CSI u encoding shift-'. Because of this, we completely disable kitty progressive enhancements and modifyOtherKeys on WezTerm. It makes no sense for every single app to work around WezTerm violating the protocol. All these workarounds just create unnecessary version dependencies. Also our workaround is brittle; it breaks as soon as you're inside something like SSH. Least importantly, the workarond prevents users of English keyboard layouts to easily use the new features. Since it seems so easy to work around by settting "enable_kitty_keyboard = false", and most importantly, since that's the default, it seems better to remove the workaround to simplify the world. See #10663 --- src/input_common.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/input_common.rs b/src/input_common.rs index e263f29fd..86c9a1d1e 100644 --- a/src/input_common.rs +++ b/src/input_common.rs @@ -432,16 +432,11 @@ static TERMINAL_PROTOCOLS: AtomicBool = AtomicBool::new(false); static IS_TMUX: RelaxedAtomicBool = RelaxedAtomicBool::new(false); static IN_MIDNIGHT_COMMANDER: RelaxedAtomicBool = RelaxedAtomicBool::new(false); static IN_ITERM_PRE_CSI_U: RelaxedAtomicBool = RelaxedAtomicBool::new(false); -static IN_WEZTERM: RelaxedAtomicBool = RelaxedAtomicBool::new(false); pub fn terminal_protocol_hacks() { use std::env::var_os; IS_TMUX.store(var_os("TMUX").is_some()); IN_MIDNIGHT_COMMANDER.store(var_os("MC_TMPDIR").is_some()); - IN_WEZTERM.store( - var_os("TERM_PROGRAM") - .is_some_and(|term_program| term_program.as_os_str().as_bytes() == b"WezTerm"), - ); IN_ITERM_PRE_CSI_U.store( var_os("LC_TERMINAL").is_some_and(|term| term.as_os_str().as_bytes() == b"iTerm2") && var_os("LC_TERMINAL_VERSION").is_some_and(|version| { @@ -478,7 +473,7 @@ pub fn terminal_protocols_enable_ifn() { return; } TERMINAL_PROTOCOLS.store(true, Ordering::Release); - let sequences = if IN_WEZTERM.load() || IN_MIDNIGHT_COMMANDER.load() { + let sequences = if IN_MIDNIGHT_COMMANDER.load() { "\x1b[?2004h" } else if IN_ITERM_PRE_CSI_U.load() { concat!("\x1b[?2004h", "\x1b[>4;1m", "\x1b[>5u", "\x1b=",) @@ -508,9 +503,7 @@ pub(crate) fn terminal_protocols_disable_ifn() { if !TERMINAL_PROTOCOLS.load(Ordering::Acquire) { return; } - let sequences = if IN_WEZTERM.load() { - "\x1b[?2004l" - } else if IN_ITERM_PRE_CSI_U.load() { + let sequences = if IN_ITERM_PRE_CSI_U.load() { concat!("\x1b[?2004l", "\x1b[>4;0m", "\x1b[<1u", "\x1b>",) } else { concat!(