Remove workaround for WezTerm configured with enable_kitty_keyboard=true
Some checks failed
Rust checks / clippy (push) Has been cancelled
make test / ubuntu (push) Has been cancelled
Rust checks / rustfmt (push) Has been cancelled
make test / ubuntu-32bit-static-pcre2 (push) Has been cancelled
make test / ubuntu-asan (push) Has been cancelled
make test / macos (push) Has been cancelled

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
This commit is contained in:
Johannes Altmanninger 2024-10-17 11:14:14 +02:00
parent 3869b59000
commit b625c566b1

View File

@ -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!(