mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
hovered_and_selected for shell
This commit is contained in:
parent
82071bd06b
commit
bcfd0c927a
4 changed files with 12 additions and 3 deletions
|
|
@ -52,4 +52,7 @@ impl Manager {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn selected_or_hovered(&self) -> Vec<&Url> { self.tabs.active().selected_or_hovered() }
|
pub fn selected_or_hovered(&self) -> Vec<&Url> { self.tabs.active().selected_or_hovered() }
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn hovered_and_selected(&self) -> Vec<&Url> { self.tabs.active().hovered_and_selected() }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ impl Tab {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut opt = opt.into() as Opt;
|
let mut opt = opt.into() as Opt;
|
||||||
let selected: Vec<_> = self.selected_or_hovered().into_iter().cloned().collect();
|
let selected: Vec<_> = self.hovered_and_selected().into_iter().cloned().collect();
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
if !opt.confirm || opt.exec.is_empty() {
|
if !opt.confirm || opt.exec.is_empty() {
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,12 @@ impl Tab {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn hovered_and_selected(&self) -> Vec<&Url> {
|
||||||
|
let mut a = self.current.hovered().map(|h| vec![&h.url]).unwrap_or_default();
|
||||||
|
a.extend(self.selected.iter());
|
||||||
|
a
|
||||||
|
}
|
||||||
|
|
||||||
// --- History
|
// --- History
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn history_new(&mut self, url: &Url) -> Folder {
|
pub fn history_new(&mut self, url: &Url) -> Folder {
|
||||||
|
|
|
||||||
4
yazi-plugin/src/external/shell.rs
vendored
4
yazi-plugin/src/external/shell.rs
vendored
|
|
@ -40,8 +40,8 @@ pub fn shell(opt: ShellOpt) -> Result<Child> {
|
||||||
.stdout(opt.stdio())
|
.stdout(opt.stdio())
|
||||||
.stderr(opt.stdio())
|
.stderr(opt.stdio())
|
||||||
.arg(opt.cmd)
|
.arg(opt.cmd)
|
||||||
.arg("") // $0 is the command name
|
.arg(&opt.args[0]) // $0 is the hovered file
|
||||||
.args(opt.args)
|
.args(&opt.args[1..])
|
||||||
.kill_on_drop(!opt.orphan)
|
.kill_on_drop(!opt.orphan)
|
||||||
.pre_exec(move || {
|
.pre_exec(move || {
|
||||||
if opt.orphan && libc::setpgid(0i32, 0i32) < 0 {
|
if opt.orphan && libc::setpgid(0i32, 0i32) < 0 {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue