fix: do not passthrough DECRQM query to tmux

This commit is contained in:
sxyazi 2025-09-23 19:05:30 +08:00
parent c0c0877d42
commit 9a804bac9c
No known key found for this signature in database

View file

@ -18,7 +18,6 @@ pub(super) struct Term {
impl Term {
pub(super) fn start() -> Result<Self> {
static SKIP: SyncCell<bool> = SyncCell::new(false);
let mut term = Self {
inner: Terminal::new(CrosstermBackend::new(TTY.writer()))?,
last_area: Default::default(),
@ -26,7 +25,8 @@ impl Term {
};
enable_raw_mode()?;
if SKIP.replace(true) && yazi_adapter::TMUX.get() {
static FIRST: SyncCell<bool> = SyncCell::new(false);
if FIRST.replace(true) && yazi_adapter::TMUX.get() {
yazi_adapter::Mux::tmux_passthrough();
}
@ -34,16 +34,15 @@ impl Term {
TTY.writer(),
yazi_term::If(!TMUX.get(), EnterAlternateScreen),
Print("\x1bP$q q\x1b\\"), // Request cursor shape (DECRQSS query for DECSCUSR)
Print(Mux::csi("\x1b[?12$p")), // Request cursor blink status (DECRQM query for DECSET 12)
Print("\x1b[?12$p"), // Request cursor blink status (DECRQM query for DECSET 12)
Print("\x1b[?u"), // Request keyboard enhancement flags (CSI u)
Print(Mux::csi("\x1b[0c")), // Request device attributes
Print("\x1b[0c"), // Request device attributes
yazi_term::If(TMUX.get(), EnterAlternateScreen),
EnableBracketedPaste,
yazi_term::If(!YAZI.mgr.mouse_events.get().is_empty(), EnableMouseCapture),
)?;
let resp = Emulator::read_until_da1();
Mux::tmux_drain()?;
yazi_term::RestoreCursor::store(&resp);
CSI_U.store(resp.contains("\x1b[?0u"), Ordering::Relaxed);
@ -62,6 +61,7 @@ impl Term {
term.hide_cursor()?;
term.clear()?;
term.flush()?;
Mux::tmux_drain()?;
Ok(term)
}