mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
60bef59598
commit
f4a0ac4de3
2 changed files with 13 additions and 16 deletions
|
|
@ -130,7 +130,7 @@ impl Emulator {
|
|||
RestorePosition
|
||||
)?;
|
||||
|
||||
let resp = futures::executor::block_on(Self::read_until_da1())?;
|
||||
let resp = futures::executor::block_on(Self::read_until_da1());
|
||||
let names = [
|
||||
("kitty", Self::Kitty),
|
||||
("Konsole", Self::Konsole),
|
||||
|
|
@ -189,7 +189,7 @@ impl Emulator {
|
|||
result
|
||||
}
|
||||
|
||||
pub async fn read_until_da1() -> Result<String> {
|
||||
pub async fn read_until_da1() -> String {
|
||||
let mut buf: Vec<u8> = Vec::with_capacity(200);
|
||||
let read = async {
|
||||
let mut stdin = BufReader::new(tokio::io::stdin());
|
||||
|
|
@ -214,6 +214,6 @@ impl Emulator {
|
|||
Ok(Err(e)) => error!("read_until_da1 failed: {buf:?}, error: {e:?}"),
|
||||
Ok(Ok(())) => {}
|
||||
}
|
||||
String::from_utf8(buf).map_err(Into::into)
|
||||
String::from_utf8_lossy(&buf).into_owned()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,19 +36,16 @@ impl Term {
|
|||
mouse::SetMouse(true),
|
||||
)?;
|
||||
|
||||
if let Ok(s) = futures::executor::block_on(Emulator::read_until_da1()) {
|
||||
CSI_U.store(s.contains("\x1b[?0u"), Ordering::Relaxed);
|
||||
BLINK.store(s.contains("\x1b[?12;1$y"), Ordering::Relaxed);
|
||||
SHAPE.store(
|
||||
s.split_once("\x1bP1$r")
|
||||
.and_then(|(_, s)| s.bytes().next())
|
||||
.filter(|&b| matches!(b, b'0'..=b'6'))
|
||||
.map_or(u8::MAX, |b| b - b'0'),
|
||||
Ordering::Relaxed,
|
||||
);
|
||||
} else {
|
||||
SHAPE.store(u8::MAX, Ordering::Relaxed);
|
||||
}
|
||||
let da = futures::executor::block_on(Emulator::read_until_da1());
|
||||
CSI_U.store(da.contains("\x1b[?0u"), Ordering::Relaxed);
|
||||
BLINK.store(da.contains("\x1b[?12;1$y"), Ordering::Relaxed);
|
||||
SHAPE.store(
|
||||
da.split_once("\x1bP1$r")
|
||||
.and_then(|(_, s)| s.bytes().next())
|
||||
.filter(|&b| matches!(b, b'0'..=b'6'))
|
||||
.map_or(u8::MAX, |b| b - b'0'),
|
||||
Ordering::Relaxed,
|
||||
);
|
||||
|
||||
if CSI_U.load(Ordering::Relaxed) {
|
||||
queue!(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue