mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Add hovered option to rename command
This commit is contained in:
parent
6ba7430f67
commit
b8cc2dcae8
1 changed files with 10 additions and 8 deletions
|
|
@ -11,6 +11,7 @@ use crate::manager::Manager;
|
|||
|
||||
pub struct Opt {
|
||||
force: bool,
|
||||
hovered: bool,
|
||||
empty: String,
|
||||
cursor: String,
|
||||
}
|
||||
|
|
@ -19,6 +20,7 @@ impl From<Cmd> for Opt {
|
|||
fn from(mut c: Cmd) -> Self {
|
||||
Self {
|
||||
force: c.bool("force"),
|
||||
hovered: c.bool("hovered"),
|
||||
empty: c.take_str("empty").unwrap_or_default(),
|
||||
cursor: c.take_str("cursor").unwrap_or_default(),
|
||||
}
|
||||
|
|
@ -27,9 +29,10 @@ impl From<Cmd> for Opt {
|
|||
|
||||
impl Manager {
|
||||
pub fn rename(&mut self, opt: impl Into<Opt>) {
|
||||
let opt = opt.into() as Opt;
|
||||
if !self.active_mut().try_escape_visual() {
|
||||
return;
|
||||
} else if !self.active().selected.is_empty() {
|
||||
} else if !opt.hovered && !self.active().selected.is_empty() {
|
||||
return self.bulk_rename();
|
||||
}
|
||||
|
||||
|
|
@ -37,7 +40,6 @@ impl Manager {
|
|||
return;
|
||||
};
|
||||
|
||||
let opt = opt.into() as Opt;
|
||||
let name = Self::empty_url_part(&hovered, &opt.empty);
|
||||
let cursor = match opt.cursor.as_str() {
|
||||
"start" => Some(0),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue