1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-28 01:06:37 +03:00

Add get_current_working_dir to Tab

This commit is contained in:
Jeremy Fitzhardinge 2020-01-10 23:18:15 -08:00 committed by Wez Furlong
parent b53412d0cb
commit 71eb27ccb5
5 changed files with 18 additions and 0 deletions

View File

@ -93,6 +93,10 @@ impl Tab for LocalTab {
fn is_mouse_grabbed(&self) -> bool {
self.terminal.borrow().is_mouse_grabbed()
}
fn get_current_working_dir(&self) -> Option<String> {
self.terminal.borrow().get_current_dir().map(String::from)
}
}
impl LocalTab {

View File

@ -69,6 +69,8 @@ pub trait Tab: Downcast {
fn set_clipboard(&self, _clipboard: &Arc<dyn Clipboard>) {}
fn get_current_working_dir(&self) -> Option<String>;
fn trickle_paste(&self, text: String) -> anyhow::Result<()> {
if text.len() <= PASTE_CHUNK_SIZE {
// Send it all now

View File

@ -307,6 +307,10 @@ impl Tab for ClientTab {
fn is_mouse_grabbed(&self) -> bool {
*self.mouse_grabbed.borrow()
}
fn get_current_working_dir(&self) -> Option<String> {
None
}
}
#[derive(Debug)]

View File

@ -284,6 +284,10 @@ impl Tab for TermWizTerminalTab {
fn is_mouse_grabbed(&self) -> bool {
true
}
fn get_current_working_dir(&self) -> Option<String> {
None
}
}
pub struct TermWizTerminal {

View File

@ -290,6 +290,10 @@ impl TerminalState {
&self.title
}
pub fn get_current_dir(&self) -> Option<&str> {
self.current_dir.as_ref().map(String::as_str)
}
/// Returns a copy of the palette.
/// By default we don't keep a copy in the terminal state,
/// preferring to take the config values from the users