From 0d7f3ef278e0f5483e5741488f97418ade147b50 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 6 Jan 2024 11:39:27 +0200 Subject: [PATCH 1/5] Fix base keymap selector keyboard shortcuts --- crates/welcome/src/base_keymap_picker.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/crates/welcome/src/base_keymap_picker.rs b/crates/welcome/src/base_keymap_picker.rs index 9a8edf0eb33b21b4d324c8390e638febe777e643..b798325473be65091a1c17a4cd6d4b1e435c015d 100644 --- a/crates/welcome/src/base_keymap_picker.rs +++ b/crates/welcome/src/base_keymap_picker.rs @@ -36,13 +36,12 @@ pub fn toggle( } pub struct BaseKeymapSelector { - focus_handle: gpui::FocusHandle, picker: View>, } impl FocusableView for BaseKeymapSelector { - fn focus_handle(&self, _cx: &AppContext) -> gpui::FocusHandle { - self.focus_handle.clone() + fn focus_handle(&self, cx: &AppContext) -> gpui::FocusHandle { + self.picker.focus_handle(cx) } } @@ -55,17 +54,13 @@ impl BaseKeymapSelector { cx: &mut ViewContext, ) -> Self { let picker = cx.new_view(|cx| Picker::new(delegate, cx)); - let focus_handle = cx.focus_handle(); - Self { - focus_handle, - picker, - } + Self { picker } } } impl Render for BaseKeymapSelector { fn render(&mut self, _cx: &mut ViewContext) -> impl IntoElement { - self.picker.clone() + v_stack().w(rems(34.)).child(self.picker.clone()) } } @@ -184,7 +179,13 @@ impl PickerDelegate for BaseKeymapSelectorDelegate { .ok(); } - fn dismissed(&mut self, _cx: &mut ViewContext>) {} + fn dismissed(&mut self, cx: &mut ViewContext>) { + self.view + .update(cx, |_, cx| { + cx.emit(DismissEvent); + }) + .log_err(); + } fn render_match( &self, From ee336cb87f83ca4ddf27c0fcd659a3c5ae3457fc Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 6 Jan 2024 11:56:01 +0200 Subject: [PATCH 2/5] Add spaces between leave call and call status icons, and call status icons and user menu --- crates/collab_ui/src/collab_titlebar_item.rs | 23 ++++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/crates/collab_ui/src/collab_titlebar_item.rs b/crates/collab_ui/src/collab_titlebar_item.rs index b8e36fbb741e9a9edc9c690aa079c6545e382715..beda9c78e8f0e69795f6f89bbc4e413b79e9484a 100644 --- a/crates/collab_ui/src/collab_titlebar_item.rs +++ b/crates/collab_ui/src/collab_titlebar_item.rs @@ -210,15 +210,19 @@ impl Render for CollabTitlebarItem { ) }) .child( - IconButton::new("leave-call", ui::Icon::Exit) - .style(ButtonStyle::Subtle) - .tooltip(|cx| Tooltip::text("Leave call", cx)) - .icon_size(IconSize::Small) - .on_click(move |_, cx| { - ActiveCall::global(cx) - .update(cx, |call, cx| call.hang_up(cx)) - .detach_and_log_err(cx); - }), + div() + .child( + IconButton::new("leave-call", ui::Icon::Exit) + .style(ButtonStyle::Subtle) + .tooltip(|cx| Tooltip::text("Leave call", cx)) + .icon_size(IconSize::Small) + .on_click(move |_, cx| { + ActiveCall::global(cx) + .update(cx, |call, cx| call.hang_up(cx)) + .detach_and_log_err(cx); + }), + ) + .pr_2(), ) .when(!read_only, |this| { this.child( @@ -296,6 +300,7 @@ impl Render for CollabTitlebarItem { }), ) }) + .child(div().pr_2()) }) .map(|el| { let status = self.client.status(); From ae14f7bd92f99c080ab40fdb1ff9725336f3d7bd Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 6 Jan 2024 12:07:48 +0200 Subject: [PATCH 3/5] Add space between menus and player stack --- crates/collab_ui/src/collab_titlebar_item.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/collab_ui/src/collab_titlebar_item.rs b/crates/collab_ui/src/collab_titlebar_item.rs index beda9c78e8f0e69795f6f89bbc4e413b79e9484a..60506f2bbbaf5ace32a60546d9677c74a1429d0b 100644 --- a/crates/collab_ui/src/collab_titlebar_item.rs +++ b/crates/collab_ui/src/collab_titlebar_item.rs @@ -92,7 +92,7 @@ impl Render for CollabTitlebarItem { .gap_1() .children(self.render_project_host(cx)) .child(self.render_project_name(cx)) - .children(self.render_project_branch(cx)) + .child(div().pr_1().children(self.render_project_branch(cx))) .when_some( current_user.clone().zip(client.peer_id()).zip(room.clone()), |this, ((current_user, peer_id), room)| { From d86ccb1afcc56518e498e71f178272f22df91812 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 6 Jan 2024 12:54:40 +0200 Subject: [PATCH 4/5] Reduce the height of the collaborators' color ribbon --- crates/collab_ui/src/collab_titlebar_item.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/crates/collab_ui/src/collab_titlebar_item.rs b/crates/collab_ui/src/collab_titlebar_item.rs index 60506f2bbbaf5ace32a60546d9677c74a1429d0b..6ccad2db0d107f4ee877ecdfd38563e880a79be5 100644 --- a/crates/collab_ui/src/collab_titlebar_item.rs +++ b/crates/collab_ui/src/collab_titlebar_item.rs @@ -41,6 +41,7 @@ pub fn init(cx: &mut AppContext) { workspace.set_titlebar_item(titlebar_item.into(), cx) }) .detach(); + // todo!() // cx.add_action(CollabTitlebarItem::share_project); // cx.add_action(CollabTitlebarItem::unshare_project); // cx.add_action(CollabTitlebarItem::toggle_user_menu); @@ -320,11 +321,19 @@ impl Render for CollabTitlebarItem { fn render_color_ribbon(participant_index: ParticipantIndex, colors: &PlayerColors) -> gpui::Canvas { let color = colors.color_for_participant(participant_index.0).cursor; canvas(move |bounds, cx| { - let mut path = Path::new(bounds.lower_left()); let height = bounds.size.height; - path.curve_to(bounds.origin + point(height, px(0.)), bounds.origin); - path.line_to(bounds.upper_right() - point(height, px(0.))); - path.curve_to(bounds.lower_right(), bounds.upper_right()); + let horizontal_offset = height; + let vertical_offset = px(height.0 / 2.0); + let mut path = Path::new(bounds.lower_left()); + path.curve_to( + bounds.origin + point(horizontal_offset, vertical_offset), + bounds.origin + point(px(0.0), vertical_offset), + ); + path.line_to(bounds.upper_right() + point(-horizontal_offset, vertical_offset)); + path.curve_to( + bounds.lower_right(), + bounds.upper_right() + point(px(0.0), vertical_offset), + ); path.line_to(bounds.lower_left()); cx.paint_path(path, color); }) From 23414d185c0e9303f24af448effbe4ea2ac1ee94 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Sat, 6 Jan 2024 18:56:55 +0100 Subject: [PATCH 5/5] Fix bug that was causing `Editor` to notify on every mouse move --- crates/editor/src/display_map.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/editor/src/display_map.rs b/crates/editor/src/display_map.rs index 8703f1ba40aa06aa0d346606af6098896fab3dfe..4511ffe407849162b603c4b3a44d51e8d552c1c9 100644 --- a/crates/editor/src/display_map.rs +++ b/crates/editor/src/display_map.rs @@ -240,7 +240,7 @@ impl DisplayMap { } pub fn clear_highlights(&mut self, type_id: TypeId) -> bool { let mut cleared = self.text_highlights.remove(&Some(type_id)).is_some(); - cleared |= self.inlay_highlights.remove(&type_id).is_none(); + cleared |= self.inlay_highlights.remove(&type_id).is_some(); cleared }