diff --git a/yazi-fm/src/term.rs b/yazi-fm/src/term.rs index 803a23a8..f77da951 100644 --- a/yazi-fm/src/term.rs +++ b/yazi-fm/src/term.rs @@ -18,7 +18,6 @@ pub(super) struct Term { impl Term { pub(super) fn start() -> Result { - static SKIP: SyncCell = 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 = 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) }