mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Rebase
This commit is contained in:
parent
de814bfc49
commit
219a17eb94
4 changed files with 15 additions and 24 deletions
|
|
@ -7,6 +7,7 @@
|
|||
)]
|
||||
|
||||
pub mod completion;
|
||||
pub mod confirm;
|
||||
pub mod help;
|
||||
pub mod input;
|
||||
pub mod manager;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use yazi_config::popup::InputCfg;
|
||||
use yazi_proxy::{InputProxy, ManagerProxy};
|
||||
use yazi_config::popup::ConfirmCfg;
|
||||
use yazi_proxy::{ConfirmProxy, ManagerProxy};
|
||||
use yazi_shared::{event::Cmd, fs::Url};
|
||||
|
||||
use crate::{manager::Manager, tasks::Tasks};
|
||||
|
|
@ -35,7 +35,7 @@ impl Manager {
|
|||
opt.targets = if opt.hovered {
|
||||
vec![hovered.clone()]
|
||||
} else {
|
||||
self.selected_or_hovered(false).cloned().collect()
|
||||
self.selected_or_hovered(true).cloned().collect()
|
||||
};
|
||||
|
||||
if opt.force {
|
||||
|
|
@ -43,17 +43,13 @@ impl Manager {
|
|||
}
|
||||
|
||||
tokio::spawn(async move {
|
||||
let mut result = InputProxy::show(if opt.permanently {
|
||||
InputCfg::delete(opt.targets.len())
|
||||
let result = ConfirmProxy::show(if opt.permanently {
|
||||
ConfirmCfg::delete(&opt.targets)
|
||||
} else {
|
||||
InputCfg::trash(opt.targets.len())
|
||||
ConfirmCfg::trash(&opt.targets)
|
||||
});
|
||||
|
||||
if let Some(Ok(choice)) = result.recv().await {
|
||||
if choice != "y" && choice != "Y" {
|
||||
return;
|
||||
}
|
||||
|
||||
if result.await {
|
||||
ManagerProxy::remove_do(opt.targets, opt.permanently);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ use std::collections::HashMap;
|
|||
|
||||
use anyhow::Result;
|
||||
use tokio::fs;
|
||||
use yazi_config::popup::InputCfg;
|
||||
use yazi_config::popup::{ConfirmCfg, InputCfg};
|
||||
use yazi_dds::Pubsub;
|
||||
use yazi_proxy::{InputProxy, TabProxy, WATCHER};
|
||||
use yazi_proxy::{ConfirmProxy, InputProxy, TabProxy, WATCHER};
|
||||
use yazi_shared::{event::Cmd, fs::{maybe_exists, ok_or_not_found, paths_to_same_file, symlink_realpath, File, FilesOp, Url}};
|
||||
|
||||
use crate::manager::Manager;
|
||||
|
|
@ -64,18 +64,12 @@ impl Manager {
|
|||
return;
|
||||
}
|
||||
|
||||
let new = hovered.parent().unwrap().join(name);
|
||||
let new = Url::from(hovered.parent().unwrap().join(name));
|
||||
if opt.force || !maybe_exists(&new).await || paths_to_same_file(&hovered, &new).await {
|
||||
Self::rename_do(tab, hovered, Url::from(new)).await.ok();
|
||||
return;
|
||||
Self::rename_do(tab, hovered, new).await.ok();
|
||||
} else if ConfirmProxy::show(ConfirmCfg::overwrite(&new)).await {
|
||||
Self::rename_do(tab, hovered, new).await.ok();
|
||||
}
|
||||
|
||||
let mut result = InputProxy::show(InputCfg::overwrite());
|
||||
if let Some(Ok(choice)) = result.recv().await {
|
||||
if choice == "y" || choice == "Y" {
|
||||
Self::rename_do(tab, hovered, Url::from(new)).await.ok();
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ impl<'a> Widget for Confirm<'a> {
|
|||
.position(confirm.offset);
|
||||
|
||||
Scrollbar::new(ScrollbarOrientation::VerticalRight).render(
|
||||
popup_layout[0].inner(&Margin { vertical: 1, horizontal: 0 }),
|
||||
popup_layout[0].inner(Margin { vertical: 1, horizontal: 0 }),
|
||||
buf,
|
||||
&mut scrollbar_state,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue