mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
feat: support cd - (cd last)
This commit is contained in:
parent
5e48df5126
commit
188727a09f
1 changed files with 10 additions and 1 deletions
|
|
@ -26,7 +26,7 @@ impl From<Cmd> for Opt {
|
||||||
|
|
||||||
impl From<Url> for Opt {
|
impl From<Url> for Opt {
|
||||||
fn from(mut target: Url) -> Self {
|
fn from(mut target: Url) -> Self {
|
||||||
if target.is_regular() {
|
if target.is_regular() && target.to_string() != "-" {
|
||||||
target = Url::from(expand_path(&target));
|
target = Url::from(expand_path(&target));
|
||||||
}
|
}
|
||||||
Self { target, interactive: false }
|
Self { target, interactive: false }
|
||||||
|
|
@ -48,6 +48,15 @@ impl Tab {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if opt.target.to_string() == "-" {
|
||||||
|
if let Some(last_cwd) = self.backstack.shift_backward() {
|
||||||
|
TabProxy::cd(&last_cwd);
|
||||||
|
}
|
||||||
|
|
||||||
|
self.backstack.push(self.cwd().clone());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Take parent to history
|
// Take parent to history
|
||||||
if let Some(rep) = self.parent.take() {
|
if let Some(rep) = self.parent.take() {
|
||||||
self.history.insert(rep.url.to_owned(), rep);
|
self.history.insert(rep.url.to_owned(), rep);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue