mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
0d44a33d12
commit
de4719d4dc
6 changed files with 11 additions and 10 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use core::{emit, files::FilesSorter, input::InputMode};
|
||||
|
||||
use config::{keymap::{Control, Exec, Key, KeymapLayer}, manager::SortBy, KEYMAP};
|
||||
use shared::optional_bool;
|
||||
use shared::{optional_bool, Url};
|
||||
|
||||
use super::Ctx;
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ impl Executor {
|
|||
"back" => cx.manager.active_mut().back(),
|
||||
"forward" => cx.manager.active_mut().forward(),
|
||||
"cd" => {
|
||||
let url = exec.args.get(0).map(Into::into).unwrap_or_default();
|
||||
let url = exec.args.get(0).map(Url::from).unwrap_or_default();
|
||||
if exec.named.contains_key("interactive") {
|
||||
cx.manager.active_mut().cd_interactive(url)
|
||||
} else {
|
||||
|
|
@ -154,7 +154,7 @@ impl Executor {
|
|||
let path = if exec.named.contains_key("current") {
|
||||
cx.manager.cwd().to_owned()
|
||||
} else {
|
||||
exec.args.get(0).map(|p| p.into()).unwrap_or("/".into())
|
||||
exec.args.get(0).map(Url::from).unwrap_or_else(|| Url::from("/"))
|
||||
};
|
||||
cx.manager.tabs_mut().create(&path)
|
||||
}
|
||||
|
|
|
|||
4
core/src/external/pdftoppm.rs
vendored
4
core/src/external/pdftoppm.rs
vendored
|
|
@ -1,4 +1,4 @@
|
|||
use std::path::Path;
|
||||
use std::{path::Path, sync::Arc};
|
||||
|
||||
use adaptor::Image;
|
||||
use regex::Regex;
|
||||
|
|
@ -25,5 +25,5 @@ pub async fn pdftoppm(src: &Path, dest: impl AsRef<Path>, skip: usize) -> Result
|
|||
return if pages > 0 { Err(PeekError::Exceed(pages - 1)) } else { Err(s.to_string().into()) };
|
||||
}
|
||||
|
||||
Ok(Image::precache_anyway(output.stdout.into(), dest).await?)
|
||||
Ok(Image::precache_anyway(Arc::new(output.stdout), dest).await?)
|
||||
}
|
||||
|
|
|
|||
5
core/src/external/zoxide.rs
vendored
5
core/src/external/zoxide.rs
vendored
|
|
@ -11,17 +11,18 @@ pub struct ZoxideOpt {
|
|||
pub fn zoxide(opt: ZoxideOpt) -> Result<Receiver<Result<Url>>> {
|
||||
let child = Command::new("zoxide")
|
||||
.args(["query", "-i", "--exclude"])
|
||||
.arg(opt.cwd)
|
||||
.arg(&opt.cwd)
|
||||
.kill_on_drop(true)
|
||||
.stdout(Stdio::piped())
|
||||
.spawn()?;
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
let cwd = opt.cwd.clone();
|
||||
tokio::spawn(async move {
|
||||
if let Ok(output) = child.wait_with_output().await {
|
||||
let selected = String::from_utf8_lossy(&output.stdout).trim().to_string();
|
||||
if !selected.is_empty() {
|
||||
tx.send(Ok(selected.into())).ok();
|
||||
tx.send(Ok(Url::new(selected, &cwd))).ok();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ impl Manager {
|
|||
})?;
|
||||
child.wait().await?;
|
||||
|
||||
let new: Vec<_> = fs::read_to_string(&tmp).await?.lines().map(|l| l.into()).collect();
|
||||
let new: Vec<_> = fs::read_to_string(&tmp).await?.lines().map(PathBuf::from).collect();
|
||||
Self::bulk_rename_do(root, old, new).await
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ impl Tasks {
|
|||
|
||||
pub fn paginate(&self) -> Vec<TaskSummary> {
|
||||
let running = self.scheduler.running.read();
|
||||
running.values().take(Self::limit()).map(|t| t.into()).collect()
|
||||
running.values().take(Self::limit()).map(Into::into).collect()
|
||||
}
|
||||
|
||||
pub fn inspect(&self) -> bool {
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ impl Precache {
|
|||
return Ok(self.sch.send(TaskOp::Adv(task.id, 1, 0))?);
|
||||
}
|
||||
if let Ok(img) = fs::read(&task.target).await {
|
||||
Image::precache(img.into(), cache).await.ok();
|
||||
Image::precache(Arc::new(img), cache).await.ok();
|
||||
}
|
||||
self.sch.send(TaskOp::Adv(task.id, 1, 0))?;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue