mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-07 20:39:04 +03:00
Merge branch 'main' into instrument-welcome-screen
This commit is contained in:
commit
ea1770254d
@ -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);
|
||||
@ -92,7 +93,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)| {
|
||||
@ -210,15 +211,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 +301,7 @@ impl Render for CollabTitlebarItem {
|
||||
}),
|
||||
)
|
||||
})
|
||||
.child(div().pr_2())
|
||||
})
|
||||
.map(|el| {
|
||||
let status = self.client.status();
|
||||
@ -315,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);
|
||||
})
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -38,13 +38,12 @@ pub fn toggle(
|
||||
}
|
||||
|
||||
pub struct BaseKeymapSelector {
|
||||
focus_handle: gpui::FocusHandle,
|
||||
picker: View<Picker<BaseKeymapSelectorDelegate>>,
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,17 +56,13 @@ impl BaseKeymapSelector {
|
||||
cx: &mut ViewContext<BaseKeymapSelector>,
|
||||
) -> 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<Self>) -> impl IntoElement {
|
||||
self.picker.clone()
|
||||
v_stack().w(rems(34.)).child(self.picker.clone())
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,7 +188,13 @@ impl PickerDelegate for BaseKeymapSelectorDelegate {
|
||||
.ok();
|
||||
}
|
||||
|
||||
fn dismissed(&mut self, _cx: &mut ViewContext<Picker<BaseKeymapSelectorDelegate>>) {}
|
||||
fn dismissed(&mut self, cx: &mut ViewContext<Picker<BaseKeymapSelectorDelegate>>) {
|
||||
self.view
|
||||
.update(cx, |_, cx| {
|
||||
cx.emit(DismissEvent);
|
||||
})
|
||||
.log_err();
|
||||
}
|
||||
|
||||
fn render_match(
|
||||
&self,
|
||||
|
Loading…
Reference in New Issue
Block a user