From 970f8db5c454685c82e848546d85a8611b22cc3b Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Tue, 22 Oct 2024 11:28:39 -0300 Subject: [PATCH] ssh: Don't erase the connection input on escape key (#19550) This PR changes the behavior of pressing the `Esc` key on the connection input. Now, if you hit it, the address inserted into the input won't be erased. Effectively, escape now only cancels the connection process instead of doing both (clearing the input _and_ cancelling the connection). Release Notes: - N/A Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> --- crates/recent_projects/src/remote_servers.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/recent_projects/src/remote_servers.rs b/crates/recent_projects/src/remote_servers.rs index e47ecda32a..3f601a15f8 100644 --- a/crates/recent_projects/src/remote_servers.rs +++ b/crates/recent_projects/src/remote_servers.rs @@ -597,7 +597,13 @@ impl RemoteServerProjects { match &self.mode { Mode::Default(_) => cx.emit(DismissEvent), Mode::CreateRemoteServer(state) if state.ssh_prompt.is_some() => { - self.mode = Mode::CreateRemoteServer(CreateRemoteServer::new(cx)); + let new_state = CreateRemoteServer::new(cx); + let old_prompt = state.address_editor.read(cx).text(cx); + new_state.address_editor.update(cx, |this, cx| { + this.set_text(old_prompt, cx); + }); + + self.mode = Mode::CreateRemoteServer(new_state); self.selectable_items.reset_selection(); cx.notify(); }