mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: broken DECSET and DECRQM requests in foot
This commit is contained in:
parent
bf206fcf31
commit
60bef59598
2 changed files with 18 additions and 22 deletions
|
|
@ -190,9 +190,9 @@ impl Emulator {
|
|||
}
|
||||
|
||||
pub async fn read_until_da1() -> Result<String> {
|
||||
let mut buf: Vec<u8> = Vec::with_capacity(200);
|
||||
let read = async {
|
||||
let mut stdin = BufReader::new(tokio::io::stdin());
|
||||
let mut buf: Vec<u8> = Vec::with_capacity(200);
|
||||
loop {
|
||||
let mut c = [0; 1];
|
||||
if stdin.read(&mut c).await? == 0 {
|
||||
|
|
@ -206,14 +206,14 @@ impl Emulator {
|
|||
break;
|
||||
}
|
||||
}
|
||||
Ok(buf)
|
||||
Ok(())
|
||||
};
|
||||
|
||||
let timeout = timeout(Duration::from_secs(10), read).await;
|
||||
if let Err(ref e) = timeout {
|
||||
error!("read_until_da1: {e:?}");
|
||||
match timeout(Duration::from_secs(10), read).await {
|
||||
Err(e) => error!("read_until_da1 timed out: {buf:?}, error: {e:?}"),
|
||||
Ok(Err(e)) => error!("read_until_da1 failed: {buf:?}, error: {e:?}"),
|
||||
Ok(Ok(())) => {}
|
||||
}
|
||||
|
||||
String::from_utf8(timeout??).map_err(Into::into)
|
||||
String::from_utf8(buf).map_err(Into::into)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,22 +14,18 @@ pub struct Plugin {
|
|||
}
|
||||
|
||||
impl Plugin {
|
||||
pub fn fetchers(
|
||||
&self,
|
||||
path: &Path,
|
||||
mime: Option<&str>,
|
||||
f: impl Fn(&str) -> bool + Copy,
|
||||
) -> Vec<&Fetcher> {
|
||||
pub fn fetchers<'a>(
|
||||
&'a self,
|
||||
path: &'a Path,
|
||||
mime: Option<&'a str>,
|
||||
factor: impl Fn(&str) -> bool + Copy,
|
||||
) -> impl Iterator<Item = &'a Fetcher> {
|
||||
let is_dir = mime == Some(MIME_DIR);
|
||||
self
|
||||
.fetchers
|
||||
.iter()
|
||||
.filter(|&p| {
|
||||
p.if_.as_ref().and_then(|c| c.eval(f)) != Some(false)
|
||||
&& (p.mime.as_ref().zip(mime).map_or(false, |(p, m)| p.match_mime(m))
|
||||
|| p.name.as_ref().is_some_and(|p| p.match_path(path, is_dir)))
|
||||
self.fetchers.iter().filter(move |&f| {
|
||||
f.if_.as_ref().and_then(|c| c.eval(factor)) != Some(false)
|
||||
&& (f.mime.as_ref().zip(mime).map_or(false, |(p, m)| p.match_mime(m))
|
||||
|| f.name.as_ref().is_some_and(|p| p.match_path(path, is_dir)))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn preloaders(&self, path: &Path, mime: Option<&str>) -> Vec<&Preloader> {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue