mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
refactor: current_name
This commit is contained in:
parent
6b65b7a62c
commit
b27ef82ecd
1 changed files with 7 additions and 2 deletions
|
|
@ -271,8 +271,13 @@ impl Tab {
|
|||
true
|
||||
}
|
||||
|
||||
pub fn current_name(&self) -> &str {
|
||||
self.current.cwd.file_name().and_then(|name| name.to_str()).unwrap_or_default()
|
||||
pub fn current_name(&self) -> Option<&str> {
|
||||
self
|
||||
.current
|
||||
.cwd
|
||||
.file_name()
|
||||
.and_then(|name| name.to_str())
|
||||
.or_else(|| self.current.cwd.to_str())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue