mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-27 12:54:42 +00:00
Swapped keyboard binding and did some minor tweaks to style and focus
This commit is contained in:
parent
b88abcacac
commit
59fd967793
6 changed files with 24 additions and 10 deletions
|
@ -310,7 +310,7 @@
|
|||
"cmd-shift-m": "diagnostics::Deploy",
|
||||
"cmd-shift-e": "project_panel::ToggleFocus",
|
||||
"cmd-alt-s": "workspace::SaveAll",
|
||||
"shift-escape": "terminal::DeployModal"
|
||||
"shift-escape": "workspace::ToggleDock"
|
||||
}
|
||||
},
|
||||
// Bindings from Sublime Text
|
||||
|
|
|
@ -57,6 +57,7 @@ pub struct Workspace {
|
|||
pub notifications: Notifications,
|
||||
pub joining_project_avatar: ImageStyle,
|
||||
pub joining_project_message: ContainedText,
|
||||
pub fullscreen_dock: ContainerStyle,
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Default)]
|
||||
|
|
|
@ -105,7 +105,7 @@ impl Dock {
|
|||
|
||||
fn ensure_not_empty(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
|
||||
let pane = workspace.dock.pane.clone();
|
||||
if !pane.read(cx).items().next().is_none() {
|
||||
if pane.read(cx).items().next().is_none() {
|
||||
let item_to_add = (workspace.dock.default_item_factory)(workspace, cx);
|
||||
Pane::add_item(workspace, &pane, item_to_add, true, true, None, cx);
|
||||
}
|
||||
|
@ -130,8 +130,12 @@ impl Dock {
|
|||
workspace.dock.position = workspace.dock.position.toggle();
|
||||
if workspace.dock.position.visible().is_some() {
|
||||
Self::ensure_not_empty(workspace, cx);
|
||||
cx.focus(workspace.dock.pane.clone());
|
||||
} else {
|
||||
cx.focus_self();
|
||||
}
|
||||
cx.notify();
|
||||
workspace.status_bar().update(cx, |_, cx| cx.notify());
|
||||
}
|
||||
|
||||
fn move_dock(
|
||||
|
@ -198,7 +202,9 @@ impl View for ToggleDockButton {
|
|||
.boxed()
|
||||
})
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
.on_click(MouseButton::Left, |_, cx| cx.dispatch_action(ToggleDock))
|
||||
.on_click(MouseButton::Left, |_, cx| {
|
||||
cx.dispatch_action(ToggleDock);
|
||||
})
|
||||
// TODO: Add tooltip
|
||||
.boxed()
|
||||
}
|
||||
|
|
|
@ -1613,8 +1613,7 @@ mod tests {
|
|||
let fs = FakeFs::new(cx.background());
|
||||
|
||||
let project = Project::test(fs, None, cx).await;
|
||||
let (_, workspace) =
|
||||
cx.add_window(|cx| Workspace::new(project, crate::tests::default_item_factory, cx));
|
||||
let (_, workspace) = cx.add_window(|cx| Workspace::new(project, default_item_factory, cx));
|
||||
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
|
||||
|
||||
// 1. Add with a destination index
|
||||
|
@ -1702,8 +1701,7 @@ mod tests {
|
|||
let fs = FakeFs::new(cx.background());
|
||||
|
||||
let project = Project::test(fs, None, cx).await;
|
||||
let (_, workspace) =
|
||||
cx.add_window(|cx| Workspace::new(project, crate::tests::default_item_factory, cx));
|
||||
let (_, workspace) = cx.add_window(|cx| Workspace::new(project, default_item_factory, cx));
|
||||
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
|
||||
|
||||
// 1. Add with a destination index
|
||||
|
@ -1779,8 +1777,7 @@ mod tests {
|
|||
let fs = FakeFs::new(cx.background());
|
||||
|
||||
let project = Project::test(fs, None, cx).await;
|
||||
let (_, workspace) =
|
||||
cx.add_window(|cx| Workspace::new(project, crate::tests::default_item_factory, cx));
|
||||
let (_, workspace) = cx.add_window(|cx| Workspace::new(project, default_item_factory, cx));
|
||||
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
|
||||
|
||||
// singleton view
|
||||
|
|
|
@ -2614,7 +2614,13 @@ impl View for Workspace {
|
|||
)
|
||||
.boxed()
|
||||
})
|
||||
.with_children(self.dock.render(&theme, DockAnchor::Expanded))
|
||||
.with_children(self.dock.render(&theme, DockAnchor::Expanded).map(
|
||||
|dock| {
|
||||
Container::new(dock)
|
||||
.with_style(theme.workspace.fullscreen_dock)
|
||||
.boxed()
|
||||
},
|
||||
))
|
||||
.with_children(self.modal.as_ref().map(|m| {
|
||||
ChildView::new(m)
|
||||
.contained()
|
||||
|
|
|
@ -156,5 +156,9 @@ export default function workspace(theme: Theme) {
|
|||
width: 400,
|
||||
margin: { right: 10, bottom: 10 },
|
||||
},
|
||||
fullscreenDock: {
|
||||
background: withOpacity(theme.backgroundColor[500].base, 0.8),
|
||||
padding: 25,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue