mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-25 01:34:02 +00:00
Made a quick fix for modal issues, better solution pending rewrite
This commit is contained in:
parent
344e037406
commit
4f9d88f3e0
3 changed files with 8 additions and 1 deletions
|
@ -409,6 +409,7 @@
|
||||||
"bindings": {
|
"bindings": {
|
||||||
"ctrl-c": "terminal::Sigint",
|
"ctrl-c": "terminal::Sigint",
|
||||||
"escape": "terminal::Escape",
|
"escape": "terminal::Escape",
|
||||||
|
"shift-escape": "terminal::DeployModal",
|
||||||
"ctrl-d": "terminal::Quit",
|
"ctrl-d": "terminal::Quit",
|
||||||
"backspace": "terminal::Del",
|
"backspace": "terminal::Del",
|
||||||
"enter": "terminal::Return",
|
"enter": "terminal::Return",
|
||||||
|
|
|
@ -3,6 +3,7 @@ use workspace::Workspace;
|
||||||
|
|
||||||
use crate::{get_wd_for_workspace, DeployModal, Event, Terminal, TerminalConnection};
|
use crate::{get_wd_for_workspace, DeployModal, Event, Terminal, TerminalConnection};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
struct StoredConnection(ModelHandle<TerminalConnection>);
|
struct StoredConnection(ModelHandle<TerminalConnection>);
|
||||||
|
|
||||||
pub fn deploy_modal(workspace: &mut Workspace, _: &DeployModal, cx: &mut ViewContext<Workspace>) {
|
pub fn deploy_modal(workspace: &mut Workspace, _: &DeployModal, cx: &mut ViewContext<Workspace>) {
|
||||||
|
@ -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 this = cx.add_view(|cx| Terminal::new(wd, true, cx));
|
||||||
let connection_handle = this.read(cx).connection.clone();
|
let connection_handle = this.read(cx).connection.clone();
|
||||||
cx.subscribe(&connection_handle, on_event).detach();
|
cx.subscribe(&connection_handle, on_event).detach();
|
||||||
|
//Set the global immediately, in case the user opens the command palette
|
||||||
|
cx.set_global::<Option<StoredConnection>>(Some(StoredConnection(
|
||||||
|
connection_handle.clone(),
|
||||||
|
)));
|
||||||
this
|
this
|
||||||
}) {
|
}) {
|
||||||
let connection = closed_terminal_handle.read(cx).connection.clone();
|
let connection = closed_terminal_handle.read(cx).connection.clone();
|
||||||
cx.set_global(Some(StoredConnection(connection)));
|
cx.set_global(Some(StoredConnection(connection)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//The problem is that the terminal modal is never re-stored.
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_event(
|
pub fn on_event(
|
||||||
|
|
1
styles/package-lock.json
generated
1
styles/package-lock.json
generated
|
@ -5,7 +5,6 @@
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "styles",
|
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
Loading…
Reference in a new issue