From c3860804ffffd08ceb91c2644808bf15761335da Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:31:03 -0300 Subject: [PATCH] ssh: Ensure long server names (and nicknames) truncate (#19621) Just polishing the UI a bit more. One drawback of this, though, is that if you _do_ have a big nickname or server name, with this current solution, you won't be able to see it. Ideally, we should be able to hover over it and see it in a tooltip, but the `div` still doesn't support that out of the box. | Main modal | Modal header | |--------|--------| | Screenshot 2024-10-23 at 12 49 18 | Screenshot 2024-10-23 at 12 49 23 | Release Notes: - N/A --- crates/recent_projects/src/remote_servers.rs | 9 ++++---- crates/recent_projects/src/ssh_connections.rs | 21 +++++++++++++------ crates/remote/src/ssh_session.rs | 2 +- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/crates/recent_projects/src/remote_servers.rs b/crates/recent_projects/src/remote_servers.rs index 654cb0a83d..101f87f1ff 100644 --- a/crates/recent_projects/src/remote_servers.rs +++ b/crates/recent_projects/src/remote_servers.rs @@ -660,11 +660,12 @@ impl RemoteServerProjects { .px_3() .gap_1() .overflow_hidden() - .whitespace_nowrap() .child( - Label::new(main_label) - .size(LabelSize::Small) - .color(Color::Muted), + div().max_w_96().overflow_hidden().text_ellipsis().child( + Label::new(main_label) + .size(LabelSize::Small) + .color(Color::Muted), + ), ) .children( aux_label.map(|label| { diff --git a/crates/recent_projects/src/ssh_connections.rs b/crates/recent_projects/src/ssh_connections.rs index 602273f017..e0bd59a248 100644 --- a/crates/recent_projects/src/ssh_connections.rs +++ b/crates/recent_projects/src/ssh_connections.rs @@ -336,17 +336,26 @@ impl RenderOnce for SshConnectionHeader { .child( h_flex() .gap_1() - .child(Headline::new(main_label).size(HeadlineSize::XSmall)) + .overflow_x_hidden() + .child( + div() + .max_w_96() + .overflow_x_hidden() + .text_ellipsis() + .child(Headline::new(main_label).size(HeadlineSize::XSmall)), + ) .children( meta_label.map(|label| { Label::new(label).color(Color::Muted).size(LabelSize::Small) }), ) - .children(self.paths.into_iter().map(|path| { - Label::new(path.to_string_lossy().to_string()) - .size(LabelSize::Small) - .color(Color::Muted) - })), + .child(div().overflow_x_hidden().text_ellipsis().children( + self.paths.into_iter().map(|path| { + Label::new(path.to_string_lossy().to_string()) + .size(LabelSize::Small) + .color(Color::Muted) + }), + )), ) } } diff --git a/crates/remote/src/ssh_session.rs b/crates/remote/src/ssh_session.rs index cbcaa6c612..f3baa5a286 100644 --- a/crates/remote/src/ssh_session.rs +++ b/crates/remote/src/ssh_session.rs @@ -1530,7 +1530,7 @@ impl SshRemoteConnection { run_cmd(self.socket.ssh_command("mkdir").arg("-p").arg(parent)).await?; } - delegate.set_status(Some("Downloading remote development server on host..."), cx); + delegate.set_status(Some("Downloading remote development server on host"), cx); let script = format!( r#"