diff --git a/src/app/mod.rs b/src/app/mod.rs index 0e9802b..f00e787 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -224,6 +224,7 @@ pub(crate) struct Ashell { pub(crate) tabs_scroll_handle: gpui::ScrollHandle, pub(crate) selector_scroll_handle: gpui::ScrollHandle, pub(crate) saved_scroll_handle: gpui::ScrollHandle, + pub(crate) connection_scroll_handle: gpui::ScrollHandle, pub(crate) connection_progress: Option, pub(crate) pending_sftp_path_sync: Option, pub(crate) sftp_context_menu: Option, @@ -404,6 +405,7 @@ impl Ashell { tabs_scroll_handle: gpui::ScrollHandle::new(), selector_scroll_handle: gpui::ScrollHandle::new(), saved_scroll_handle: gpui::ScrollHandle::new(), + connection_scroll_handle: gpui::ScrollHandle::new(), connection_progress: None, pending_sftp_path_sync: Some("/".into()), sftp_context_menu: None, @@ -541,6 +543,8 @@ impl Ashell { if let Some(progress) = self.connection_progress.as_mut() { if progress.tab_id == tab_id { progress.lines.push(text.clone().into()); + let _idx = progress.lines.len().saturating_sub(1); + self.connection_scroll_handle.set_offset(point(px(0.), px(-99999.0))); } } self.status = text.into(); @@ -692,6 +696,8 @@ impl Ashell { if let Some(progress) = self.connection_progress.as_mut() { if progress.tab_id == tab_id { progress.lines.push(reason.clone().into()); + let _idx = progress.lines.len().saturating_sub(1); + self.connection_scroll_handle.set_offset(point(px(0.), px(-99999.0))); let _ = session_label; let _ = tab_title; progress.title = t!("connection_failed").into(); diff --git a/src/app/ui.rs b/src/app/ui.rs index 7cdb6f2..72b29cb 100644 --- a/src/app/ui.rs +++ b/src/app/ui.rs @@ -1984,20 +1984,46 @@ impl Render for Ashell { .loading(!progress.failed) .label(progress.title.clone()), ) - .child(div().max_h(px(220.)).overflow_y_scrollbar().child( - v_flex().gap_2().children( - progress.lines.iter().cloned().map(|line| { + .child( + div() + .relative() + .min_h(px(0.)) + .max_h(px(220.)) + .child( div() - .text_size(rems(1.0)) - .text_color(if progress.failed { - cx.theme().danger - } else { - cx.theme().muted_foreground - }) - .child(line) - }), - ), - )) + .id("connection-progress-scroll") + .max_h(px(220.)) + .overflow_hidden() + .overflow_y_scroll() + .track_scroll(&self.connection_scroll_handle) + .child( + v_flex().gap_2().children( + progress.lines.iter().cloned().map(|line| { + div() + .text_size(rems(1.0)) + .text_color(if progress.failed { + cx.theme().danger + } else { + cx.theme().muted_foreground + }) + .child(line) + }), + ), + ) + ) + .child( + div() + .absolute() + .top_0() + .right_0() + .bottom_0() + .w(px(16.)) + .child( + Scrollbar::vertical(&self.connection_scroll_handle) + .scrollbar_show(ScrollbarShow::Scrolling) + ) + ) + ) .when(progress.failed, |this| { this.child( h_flex()