fix: avoid tmux interfering with kitty graphical sequences (#2734)

This commit is contained in:
三咲雅 · Misaki Masa 2025-05-07 09:54:20 +08:00 committed by GitHub
parent db60951783
commit 4e2a8bdf51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 11 deletions

View file

@ -379,14 +379,14 @@ impl Kgp {
fn place(area: &Rect) -> Result<Vec<u8>> {
let mut buf = Vec::with_capacity(area.width as usize * area.height as usize * 3 + 50);
write!(buf, "\x1b[38;2;0;0;1m")?;
for y in 0..area.height {
write!(buf, "\x1b[{};{}H\x1b[38;5;1m", area.y + y + 1, area.x + 1)?;
write!(buf, "\x1b[{};{}H", area.y + y + 1, area.x + 1)?;
for x in 0..area.width {
write!(buf, "\u{10EEEE}")?;
write!(buf, "{}", *DIACRITICS.get(y as usize).unwrap_or(&DIACRITICS[0]))?;
write!(buf, "{}", *DIACRITICS.get(x as usize).unwrap_or(&DIACRITICS[0]))?;
}
write!(buf, "\x1b[0m")?;
}
Ok(buf)
}

View file

@ -88,7 +88,7 @@ impl Emulator {
{
use std::{io::Write, thread, time::Duration};
use crossterm::{cursor::{Hide, MoveTo, RestorePosition, SavePosition, Show}, queue};
use crossterm::{cursor::{Hide, MoveTo, Show}, queue};
let mut w = TTY.lockout();

View file

@ -28,12 +28,8 @@ impl Tab {
// Visual selection
if let Some((start, items)) = self.mode.visual_mut() {
let after = self.current.cursor;
items.clear();
for i in start.min(after)..=after.max(start) {
items.insert(i);
}
let end = self.current.cursor;
*items = (start.min(end)..=end.max(start)).collect();
}
self.hover(None);

View file

@ -32,12 +32,12 @@ impl Term {
execute!(
TTY.writer(),
yazi_term::If(TMUX.get(), EnterAlternateScreen),
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 (DECSET)
Print("\x1b[?u"), // Request keyboard enhancement flags (CSI u)
Print(Mux::csi("\x1b[0c")), // Request device attributes
yazi_term::If(!TMUX.get(), EnterAlternateScreen),
yazi_term::If(TMUX.get(), EnterAlternateScreen),
EnableBracketedPaste,
yazi_term::If(!YAZI.mgr.mouse_events.is_empty(), EnableMouseCapture),
)?;