Fix incorrect rendering of toolbar in right anchored dock

Make dock keybinding activate the dock if it wasn't hidden, and hide it if it was already active
Make clicking the expanded dock wash, hide the dock
Fix some issues with programmatically activating other panes, not hiding the dock
Tweak dock anchor menu text
Swap dock hide button for thin variant
Fix dock sidebar interactions
Add clicked state to search button and fix presenter issue sending clicked events when mouse not overlapping MouseRegion

Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
K Simmons 2022-09-13 15:17:27 -07:00
parent 3c88aa3d18
commit 0b5952e1bd
10 changed files with 134 additions and 131 deletions

View file

@ -1,72 +0,0 @@
use gpui::{ModelHandle, ViewContext};
use workspace::Workspace;
use crate::{terminal_container_view::DeployModal, Event, Terminal};
pub fn deploy_modal(_workspace: &mut Workspace, _: &DeployModal, _cx: &mut ViewContext<Workspace>) {
// let window = cx.window_id();
// // Pull the terminal connection out of the global if it has been stored
// let possible_terminal = Dock::remove::<Terminal, _>(window, cx);
// if let Some(terminal_handle) = possible_terminal {
// workspace.toggle_modal(cx, |_, cx| {
// // Create a view from the stored connection if the terminal modal is not already shown
// cx.add_view(|cx| TerminalContainer::from_terminal(terminal_handle.clone(), true, cx))
// });
// // Toggle Modal will dismiss the terminal modal if it is currently shown, so we must
// // store the terminal back in the global
// Dock::insert_or_replace::<Terminal, _>(window, terminal_handle, cx);
// } else {
// // No connection was stored, create a new terminal
// if let Some(closed_terminal_handle) = workspace.toggle_modal(cx, |workspace, cx| {
// // No terminal modal visible, construct a new one.
// let wd_strategy = cx
// .global::<Settings>()
// .terminal_overrides
// .working_directory
// .clone()
// .unwrap_or(WorkingDirectory::CurrentProjectDirectory);
// let working_directory = get_working_directory(workspace, cx, wd_strategy);
// let this = cx.add_view(|cx| TerminalContainer::new(working_directory, true, cx));
// if let TerminalContainerContent::Connected(connected) = &this.read(cx).content {
// let terminal_handle = connected.read(cx).handle();
// cx.subscribe(&terminal_handle, on_event).detach();
// // Set the global immediately if terminal construction was successful,
// // in case the user opens the command palette
// Dock::insert_or_replace::<Terminal, _>(window, terminal_handle, cx);
// }
// this
// }) {
// // Terminal modal was dismissed and the terminal view is connected, store the terminal
// if let TerminalContainerContent::Connected(connected) =
// &closed_terminal_handle.read(cx).content
// {
// let terminal_handle = connected.read(cx).handle();
// // Set the global immediately if terminal construction was successful,
// // in case the user opens the command palette
// Dock::insert_or_replace::<Terminal, _>(window, terminal_handle, cx);
// }
// }
// }
}
pub fn on_event(
_workspace: &mut Workspace,
_: ModelHandle<Terminal>,
_event: &Event,
_cx: &mut ViewContext<Workspace>,
) {
// Dismiss the modal if the terminal quit
// if let Event::CloseTerminal = event {
// Dock::remove::<Terminal, _>(cx.window_id(), cx);
// if workspace.modal::<TerminalContainer>().is_some() {
// workspace.dismiss_modal(cx)
// }
// }
}

View file

@ -1,5 +1,4 @@
pub mod mappings;
pub mod modal;
pub mod terminal_container_view;
pub mod terminal_element;
pub mod terminal_view;
@ -32,7 +31,6 @@ use futures::{
use mappings::mouse::{
alt_scroll, mouse_button_report, mouse_moved_report, mouse_point, mouse_side, scroll_report,
};
use modal::deploy_modal;
use procinfo::LocalProcessInfo;
use settings::{AlternateScroll, Settings, Shell, TerminalBlink};
@ -63,8 +61,6 @@ use crate::mappings::{
///Initialize and register all of our action handlers
pub fn init(cx: &mut MutableAppContext) {
cx.add_action(deploy_modal);
terminal_view::init(cx);
terminal_container_view::init(cx);
}