diff options
Diffstat (limited to 'src/tab/tab_struct.rs')
-rw-r--r-- | src/tab/tab_struct.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tab/tab_struct.rs b/src/tab/tab_struct.rs index 1afb642..7db65b4 100644 --- a/src/tab/tab_struct.rs +++ b/src/tab/tab_struct.rs @@ -1,4 +1,6 @@ +use std::borrow::Cow; use std::collections::HashMap; +use std::ffi::OsStr; use std::path; use crate::config::option::{DisplayOption, TabDisplayOption}; @@ -108,4 +110,11 @@ impl JoshutoTab { self.history.get_mut(child_path.as_path()) } + + pub fn tab_title(&self) -> Cow<'_, str> { + self.cwd() + .file_name() + .unwrap_or_else(|| OsStr::new("/")) + .to_string_lossy() + } } |