From 4f9d88f3e0abaa498f5cefb84de6a71a73702caf Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Wed, 13 Jul 2022 13:06:23 -0700 Subject: [PATCH] Made a quick fix for modal issues, better solution pending rewrite --- assets/keymaps/default.json | 1 + crates/terminal/src/modal.rs | 7 +++++++ styles/package-lock.json | 1 - 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/assets/keymaps/default.json b/assets/keymaps/default.json index 6cd3660bf5..e40a5426dd 100644 --- a/assets/keymaps/default.json +++ b/assets/keymaps/default.json @@ -409,6 +409,7 @@ "bindings": { "ctrl-c": "terminal::Sigint", "escape": "terminal::Escape", + "shift-escape": "terminal::DeployModal", "ctrl-d": "terminal::Quit", "backspace": "terminal::Del", "enter": "terminal::Return", diff --git a/crates/terminal/src/modal.rs b/crates/terminal/src/modal.rs index 43452e5221..1130050690 100644 --- a/crates/terminal/src/modal.rs +++ b/crates/terminal/src/modal.rs @@ -3,6 +3,7 @@ use workspace::Workspace; use crate::{get_wd_for_workspace, DeployModal, Event, Terminal, TerminalConnection}; +#[derive(Debug)] struct StoredConnection(ModelHandle); pub fn deploy_modal(workspace: &mut Workspace, _: &DeployModal, cx: &mut ViewContext) { @@ -24,12 +25,18 @@ pub fn deploy_modal(workspace: &mut Workspace, _: &DeployModal, cx: &mut ViewCon let this = cx.add_view(|cx| Terminal::new(wd, true, cx)); let connection_handle = this.read(cx).connection.clone(); cx.subscribe(&connection_handle, on_event).detach(); + //Set the global immediately, in case the user opens the command palette + cx.set_global::>(Some(StoredConnection( + connection_handle.clone(), + ))); this }) { let connection = closed_terminal_handle.read(cx).connection.clone(); cx.set_global(Some(StoredConnection(connection))); } } + + //The problem is that the terminal modal is never re-stored. } pub fn on_event( diff --git a/styles/package-lock.json b/styles/package-lock.json index 49304dc2fa..2eb6d3a1bf 100644 --- a/styles/package-lock.json +++ b/styles/package-lock.json @@ -5,7 +5,6 @@ "requires": true, "packages": { "": { - "name": "styles", "version": "1.0.0", "license": "ISC", "dependencies": {