diff --git a/src/app/mod.rs b/src/app/mod.rs index 1c68162..485b087 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -292,6 +292,26 @@ pub(crate) struct SftpContextMenuState { } impl Ashell { + fn transfer_source_title(&self, tab_id: &str) -> String { + self.tabs + .iter() + .find(|tab| tab.id == tab_id) + .map(|tab| tab.title.clone()) + .or_else(|| { + self.tab_groups + .iter() + .find(|group| group.id == tab_id) + .map(|group| group.title.clone()) + }) + .or_else(|| { + self.tab_groups + .iter() + .find(|group| group.pane_root.contains(tab_id)) + .map(|group| group.title.clone()) + }) + .unwrap_or_else(|| "Unknown".to_string()) + } + pub(crate) fn new(window: &mut Window, cx: &mut Context) -> Self { let host_input = cx.new(|cx| InputState::new(window, cx).placeholder(t!("host"))); let session_name_input = @@ -716,12 +736,7 @@ impl Ashell { } } BackendEvent::TransferStarted { tab_id, info } => { - let tab_title = self - .tabs - .iter() - .find(|t| t.id == tab_id) - .map(|t| t.title.clone()) - .unwrap_or_else(|| "Unknown".to_string()); + let tab_title = self.transfer_source_title(&tab_id); self.transfers.insert( 0, crate::terminal::Transfer { diff --git a/src/sftp/ops.rs b/src/sftp/ops.rs index fac86f7..68fe243 100644 --- a/src/sftp/ops.rs +++ b/src/sftp/ops.rs @@ -181,6 +181,10 @@ impl Ashell { local_path ); handle.download(remote_path, local_path); + this.update(cx, |this, cx| { + this.show_transfers_dialog = true; + cx.notify(); + })?; } } Ok(Err(err)) => { @@ -221,6 +225,10 @@ impl Ashell { remote_dir ); handle.upload_paths(vec![local_path], remote_dir); + this.update(cx, |this, cx| { + this.show_transfers_dialog = true; + cx.notify(); + })?; } } Ok(Err(err)) => { @@ -261,6 +269,10 @@ impl Ashell { remote_dir ); handle.upload_paths(vec![local_path], remote_dir); + this.update(cx, |this, cx| { + this.show_transfers_dialog = true; + cx.notify(); + })?; } } Ok(Err(err)) => { @@ -350,6 +362,7 @@ impl Ashell { if let Some(sftp_mut) = this.active_sftp_mut() { sftp_mut.selected_entries.clear(); } + this.show_transfers_dialog = true; cx.notify(); }); } @@ -359,7 +372,7 @@ impl Ashell { .detach(); } - pub(crate) fn upload_sftp_files_batch(&mut self, paths: Vec, _cx: &mut Context) { + pub(crate) fn upload_sftp_files_batch(&mut self, paths: Vec, cx: &mut Context) { if paths.is_empty() { return; } @@ -374,6 +387,8 @@ impl Ashell { locals: paths, remote_dir: sftp.current_path.clone(), }); + self.show_transfers_dialog = true; + cx.notify(); } } }