Revert "Swap alt-{left,right,backspace,delete} with ctrl-* on macOS"

This reverts commit ebdc3a0393.

Not discussed, includes a new thing that queries the terminal for the client OS
when what is really needed is just a `uname` - which would also work on Terminal.app.
This commit is contained in:
Fabian Boehm
2025-01-19 18:52:10 +01:00
parent 0494b1b608
commit 98a96f5b58
8 changed files with 16 additions and 146 deletions

View File

@@ -24,7 +24,7 @@
use std::os::fd::RawFd;
use std::os::unix::ffi::OsStrExt;
use std::ptr;
use std::sync::atomic::{AtomicBool, AtomicU8, AtomicUsize, Ordering};
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
// The range of key codes for inputrc-style keyboard functions.
pub const R_END_INPUT_FUNCTIONS: usize = (ReadlineCmd::ReverseRepeatJump as usize) + 1;
@@ -450,31 +450,6 @@ pub fn update_wait_on_sequence_key_ms(vars: &EnvStack) {
pub(crate) static SCROLL_FORWARD_SUPPORTED: RelaxedAtomicBool = RelaxedAtomicBool::new(false);
pub(crate) static CURSOR_UP_SUPPORTED: RelaxedAtomicBool = RelaxedAtomicBool::new(false);
#[derive(Copy, Clone, Debug)]
#[repr(u8)]
pub(crate) enum ClientOS {
Bsd,
Linux,
macOS,
Unknown,
}
impl std::fmt::Display for ClientOS {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let name = match self {
ClientOS::Bsd => "bsd",
ClientOS::Linux => "linux",
ClientOS::macOS => "macos",
ClientOS::Unknown => "unknown",
};
f.write_str(name)
}
}
// As first approximation, use the target OS. This should be overwritten by the XTGETTCAP
// query later.
pub(crate) static CLIENT_OS: AtomicU8 = AtomicU8::new(ClientOS::Unknown as _);
static KITTY_KEYBOARD_SUPPORTED: RelaxedAtomicBool = RelaxedAtomicBool::new(false);
macro_rules! kitty_progressive_enhancements {
@@ -493,7 +468,7 @@ pub(crate) fn enable_kitty_progressive_enhancements() -> bool {
true
}
pub(crate) static IS_TMUX: RelaxedAtomicBool = RelaxedAtomicBool::new(false);
static IS_TMUX: RelaxedAtomicBool = RelaxedAtomicBool::new(false);
pub static IN_MIDNIGHT_COMMANDER_PRE_CSI_U: RelaxedAtomicBool = RelaxedAtomicBool::new(false);
static IN_ITERM_PRE_CSI_U: RelaxedAtomicBool = RelaxedAtomicBool::new(false);
@@ -510,20 +485,6 @@ pub fn terminal_protocol_hacks() {
version < (99, 5, 6)
}),
);
CLIENT_OS.store(
(if cfg!(target_os = "macos")
|| var_os("LC_TERMINAL").is_some_and(|term| term.as_os_str().as_bytes() == b"iTerm2")
{
ClientOS::macOS
} else if cfg!(bsd) {
ClientOS::Bsd
} else if cfg!(target_os = "linux") {
ClientOS::Linux
} else {
ClientOS::Unknown
}) as _,
Ordering::Relaxed,
);
}
fn parse_version(version: &wstr) -> Option<(i64, i64, i64)> {
@@ -1359,16 +1320,6 @@ fn parse_dcs(&mut self, buffer: &mut Vec<u8>) -> Option<Key> {
CURSOR_UP_SUPPORTED.store(true);
FLOG!(reader, "Cursor up is supported");
}
if key == b"kitty-query-os_name" {
let os = match &value[..] {
b"bsd" => ClientOS::Bsd,
b"macos" => ClientOS::macOS,
b"linux" => ClientOS::Linux,
_ => ClientOS::Unknown,
};
CLIENT_OS.store(os as _, Ordering::Relaxed);
FLOG!(reader, "Client OS: ", os);
}
return None;
}