mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 12:41:08 +08:00
Use kitty keyboard protocol again for recent Midnight Commander
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / clippy (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / clippy (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
See https://midnight-commander.org/ticket/4597
This commit is contained in:
parent
9ef76860e6
commit
bd9fee417b
|
@ -431,13 +431,12 @@ pub fn update_wait_on_sequence_key_ms(vars: &EnvStack) {
|
||||||
static TERMINAL_PROTOCOLS: AtomicBool = AtomicBool::new(false);
|
static TERMINAL_PROTOCOLS: AtomicBool = AtomicBool::new(false);
|
||||||
|
|
||||||
static IS_TMUX: RelaxedAtomicBool = RelaxedAtomicBool::new(false);
|
static IS_TMUX: RelaxedAtomicBool = RelaxedAtomicBool::new(false);
|
||||||
static IN_MIDNIGHT_COMMANDER: 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);
|
static IN_ITERM_PRE_CSI_U: RelaxedAtomicBool = RelaxedAtomicBool::new(false);
|
||||||
|
|
||||||
pub fn terminal_protocol_hacks() {
|
pub fn terminal_protocol_hacks() {
|
||||||
use std::env::var_os;
|
use std::env::var_os;
|
||||||
IS_TMUX.store(var_os("TMUX").is_some());
|
IS_TMUX.store(var_os("TMUX").is_some());
|
||||||
IN_MIDNIGHT_COMMANDER.store(var_os("MC_TMPDIR").is_some());
|
|
||||||
IN_ITERM_PRE_CSI_U.store(
|
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").is_some_and(|term| term.as_os_str().as_bytes() == b"iTerm2")
|
||||||
&& var_os("LC_TERMINAL_VERSION").is_some_and(|version| {
|
&& var_os("LC_TERMINAL_VERSION").is_some_and(|version| {
|
||||||
|
@ -474,7 +473,7 @@ pub fn terminal_protocols_enable_ifn() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TERMINAL_PROTOCOLS.store(true, Ordering::Release);
|
TERMINAL_PROTOCOLS.store(true, Ordering::Release);
|
||||||
let sequences = if IN_MIDNIGHT_COMMANDER.load() {
|
let sequences = if IN_MIDNIGHT_COMMANDER_PRE_CSI_U.load() {
|
||||||
"\x1b[?2004h"
|
"\x1b[?2004h"
|
||||||
} else if IN_ITERM_PRE_CSI_U.load() {
|
} else if IN_ITERM_PRE_CSI_U.load() {
|
||||||
concat!("\x1b[?2004h", "\x1b[>4;1m", "\x1b[>5u", "\x1b=",)
|
concat!("\x1b[?2004h", "\x1b[>4;1m", "\x1b[>5u", "\x1b=",)
|
||||||
|
|
|
@ -75,6 +75,7 @@ use crate::history::{
|
||||||
SearchType,
|
SearchType,
|
||||||
};
|
};
|
||||||
use crate::input::init_input;
|
use crate::input::init_input;
|
||||||
|
use crate::input_common::IN_MIDNIGHT_COMMANDER_PRE_CSI_U;
|
||||||
use crate::input_common::{
|
use crate::input_common::{
|
||||||
terminal_protocol_hacks, terminal_protocols_enable_ifn, CharEvent, CharInputStyle, InputData,
|
terminal_protocol_hacks, terminal_protocols_enable_ifn, CharEvent, CharInputStyle, InputData,
|
||||||
ReadlineCmd,
|
ReadlineCmd,
|
||||||
|
@ -3976,6 +3977,8 @@ fn reader_interactive_init(parser: &Parser) {
|
||||||
.set_one(L!("_"), EnvMode::GLOBAL, L!("fish").to_owned());
|
.set_one(L!("_"), EnvMode::GLOBAL, L!("fish").to_owned());
|
||||||
|
|
||||||
terminal_protocol_hacks();
|
terminal_protocol_hacks();
|
||||||
|
IN_MIDNIGHT_COMMANDER_PRE_CSI_U
|
||||||
|
.store(parser.vars().get_unless_empty(L!("__mc_csi_u")).is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Destroy data for interactive use.
|
/// Destroy data for interactive use.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user