diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rs index 21cc9f889580f10d3ece2e2dfee7c18c203c37c4..0176a1e01bd999b2786a9e84aa79d39340dce45b 100644 --- a/crates/editor/src/editor_tests.rs +++ b/crates/editor/src/editor_tests.rs @@ -485,7 +485,7 @@ fn test_navigation_history(cx: &mut gpui::MutableAppContext) { cx.set_global(DragAndDrop::::default()); use workspace::item::Item; let (_, pane) = cx.add_window(Default::default(), |cx| { - Pane::new(None, || unimplemented!(), cx) + Pane::new(0, None, || unimplemented!(), cx) }); let buffer = MultiBuffer::build_simple(&sample_text(300, 5, 'a'), cx); @@ -5564,7 +5564,7 @@ async fn test_following_with_multiple_excerpts(cx: &mut gpui::TestAppContext) { Settings::test_async(cx); let fs = FakeFs::new(cx.background()); let project = Project::test(fs, ["/file.rs".as_ref()], cx).await; - let (_, pane) = cx.add_window(|cx| Pane::new(None, || unimplemented!(), cx)); + let (_, pane) = cx.add_window(|cx| Pane::new(0, None, || unimplemented!(), cx)); let leader = pane.update(cx, |_, cx| { let multibuffer = cx.add_model(|_| MultiBuffer::new(0)); diff --git a/crates/theme/src/ui.rs b/crates/theme/src/ui.rs index ca71db37231531f1d76312807f55551a7b181c9b..5396265ad8fc0f5db41616a5acfd973e21c3ff70 100644 --- a/crates/theme/src/ui.rs +++ b/crates/theme/src/ui.rs @@ -97,6 +97,24 @@ pub fn keystroke_label( ) -> Container { // FIXME: Put the theme in it's own global so we can // query the keystroke style on our own + keystroke_label_for( + cx.window_id(), + cx.handle().id(), + label_text, + label_style, + keystroke_style, + action, + ) +} + +pub fn keystroke_label_for( + window_id: usize, + view_id: usize, + label_text: &'static str, + label_style: &ContainedText, + keystroke_style: &ContainedText, + action: Box, +) -> Container { Flex::row() .with_child( Label::new(label_text, label_style.text.clone()) @@ -105,8 +123,8 @@ pub fn keystroke_label( ) .with_child({ KeystrokeLabel::new( - cx.window_id(), - cx.handle().id(), + window_id, + view_id, action, keystroke_style.container, keystroke_style.text.clone(), diff --git a/crates/workspace/src/dock.rs b/crates/workspace/src/dock.rs index f86a9db71acf1b9b09cb66fd8b30d4cde9708a08..efba568b90458882d5d0d11e0250565dd2c1abca 100644 --- a/crates/workspace/src/dock.rs +++ b/crates/workspace/src/dock.rs @@ -187,7 +187,14 @@ impl Dock { ) -> Self { let position = DockPosition::Hidden(cx.global::().default_dock_anchor); - let pane = cx.add_view(|cx| Pane::new(Some(position.anchor()), background_actions, cx)); + let pane = cx.add_view(|cx| { + Pane::new( + cx.handle().id(), + Some(position.anchor()), + background_actions, + cx, + ) + }); pane.update(cx, |pane, cx| { pane.set_active(false, cx); }); diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 7e0e6bbe01d22bc891b22a93a92154e3a843608c..abd410d875969a7d12611bae8d8e760ed9ade00e 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -218,6 +218,7 @@ pub struct Pane { tab_bar_context_menu: ViewHandle, docked: Option, background_actions: BackgroundActions, + workspace_id: usize, } pub struct ItemNavHistory { @@ -275,6 +276,7 @@ enum ItemType { impl Pane { pub fn new( + workspace_id: usize, docked: Option, background_actions: BackgroundActions, cx: &mut ViewContext, @@ -300,6 +302,7 @@ impl Pane { tab_bar_context_menu: context_menu, docked, background_actions, + workspace_id, } } @@ -1442,6 +1445,7 @@ impl Pane { .with_children({ enum KeyboardHint {} let keyboard_hint = &theme.keyboard_hint; + let workspace_id = self.workspace_id; (self.background_actions)().into_iter().enumerate().map( move |(idx, (text, action))| { let hint_action = action.boxed_clone(); @@ -1449,14 +1453,15 @@ impl Pane { idx, cx, move |state, cx| { - theme::ui::keystroke_label( + theme::ui::keystroke_label_for( + cx.window_id(), + workspace_id, text, &keyboard_hint.style_for(state, false), &keystroke_style .style_for(state, false) .keystroke, hint_action, - cx, ) .boxed() }, diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 65335d8671069d5e93a7852acbc5bed87852763d..40053b103a4341952c2a263f04b99e6be958616a 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -606,7 +606,9 @@ impl Workspace { }) .detach(); - let center_pane = cx.add_view(|cx| Pane::new(None, background_actions, cx)); + let workspace_view_id = cx.handle().id(); + let center_pane = + cx.add_view(|cx| Pane::new(workspace_view_id, None, background_actions, cx)); let pane_id = center_pane.id(); cx.subscribe(¢er_pane, move |this, _, event, cx| { this.handle_pane_event(pane_id, event, cx) @@ -1438,7 +1440,7 @@ impl Workspace { } fn add_pane(&mut self, cx: &mut ViewContext) -> ViewHandle { - let pane = cx.add_view(|cx| Pane::new(None, self.background_actions, cx)); + let pane = cx.add_view(|cx| Pane::new(cx.handle().id(), None, self.background_actions, cx)); let pane_id = pane.id(); cx.subscribe(&pane, move |this, _, event, cx| { this.handle_pane_event(pane_id, event, cx) diff --git a/styles/src/styleTree/workspace.ts b/styles/src/styleTree/workspace.ts index 55b5c613410d1141b6a8e72c64aff2044c94cb51..cb99572853e1859d61dc4fde37b1e96d2faf0def 100644 --- a/styles/src/styleTree/workspace.ts +++ b/styles/src/styleTree/workspace.ts @@ -46,8 +46,8 @@ export default function workspace(colorScheme: ColorScheme) { color: background(layer, "on"), icon: "icons/logo_96.svg", dimensions: { - width: 240, - height: 240, + width: 256, + height: 256, } }, keyboardHints: { @@ -67,7 +67,7 @@ export default function workspace(colorScheme: ColorScheme) { ...text(colorScheme.lowest, "sans", "hovered", { size: "sm" }), } }, - keyboardHintWidth: 240, + keyboardHintWidth: 256, }, joiningProjectAvatar: { cornerRadius: 40,