mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-07 17:26:56 +00:00
Use buffer font size for editor overlays and blocks
Co-authored-by: Nathan <nathan@zed.dev>
This commit is contained in:
parent
850a9e33e3
commit
4b006ccd5b
3 changed files with 52 additions and 42 deletions
|
@ -1195,7 +1195,6 @@ impl CompletionsMenu {
|
|||
.min_w(px(260.))
|
||||
.max_w(px(640.))
|
||||
.w(px(500.))
|
||||
.text_ui()
|
||||
.overflow_y_scroll()
|
||||
// Prevent a mouse down on documentation from being propagated to the editor,
|
||||
// because that would move the cursor.
|
||||
|
@ -1251,7 +1250,6 @@ impl CompletionsMenu {
|
|||
.max_w(px(540.))
|
||||
.whitespace_nowrap()
|
||||
.overflow_hidden()
|
||||
.text_ui()
|
||||
.px_1()
|
||||
.rounded(px(4.))
|
||||
.bg(cx.theme().colors().ghost_element_background)
|
||||
|
@ -1425,7 +1423,6 @@ impl CodeActionsMenu {
|
|||
let colors = cx.theme().colors();
|
||||
div()
|
||||
.px_2()
|
||||
.text_ui()
|
||||
.text_color(colors.text)
|
||||
.when(selected, |style| {
|
||||
style
|
||||
|
|
|
@ -2811,50 +2811,65 @@ impl Element for EditorElement {
|
|||
) {
|
||||
let editor = self.editor.clone();
|
||||
|
||||
let mut layout = self.compute_layout(bounds, cx);
|
||||
let gutter_bounds = Bounds {
|
||||
origin: bounds.origin,
|
||||
size: layout.gutter_size,
|
||||
};
|
||||
let text_bounds = Bounds {
|
||||
origin: gutter_bounds.upper_right(),
|
||||
size: layout.text_size,
|
||||
};
|
||||
cx.with_text_style(
|
||||
Some(gpui::TextStyleRefinement {
|
||||
font_size: Some(self.style.text.font_size),
|
||||
..Default::default()
|
||||
}),
|
||||
|cx| {
|
||||
let mut layout = self.compute_layout(bounds, cx);
|
||||
let gutter_bounds = Bounds {
|
||||
origin: bounds.origin,
|
||||
size: layout.gutter_size,
|
||||
};
|
||||
let text_bounds = Bounds {
|
||||
origin: gutter_bounds.upper_right(),
|
||||
size: layout.text_size,
|
||||
};
|
||||
|
||||
let focus_handle = editor.focus_handle(cx);
|
||||
let key_context = self.editor.read(cx).key_context(cx);
|
||||
cx.with_key_dispatch(Some(key_context), Some(focus_handle.clone()), |_, cx| {
|
||||
self.register_actions(cx);
|
||||
self.register_key_listeners(cx);
|
||||
let focus_handle = editor.focus_handle(cx);
|
||||
let key_context = self.editor.read(cx).key_context(cx);
|
||||
cx.with_key_dispatch(Some(key_context), Some(focus_handle.clone()), |_, cx| {
|
||||
self.register_actions(cx);
|
||||
self.register_key_listeners(cx);
|
||||
|
||||
cx.with_content_mask(Some(ContentMask { bounds }), |cx| {
|
||||
let input_handler = ElementInputHandler::new(bounds, self.editor.clone(), cx);
|
||||
cx.handle_input(&focus_handle, input_handler);
|
||||
cx.with_content_mask(Some(ContentMask { bounds }), |cx| {
|
||||
let input_handler =
|
||||
ElementInputHandler::new(bounds, self.editor.clone(), cx);
|
||||
cx.handle_input(&focus_handle, input_handler);
|
||||
|
||||
self.paint_background(gutter_bounds, text_bounds, &layout, cx);
|
||||
if layout.gutter_size.width > Pixels::ZERO {
|
||||
self.paint_gutter(gutter_bounds, &mut layout, cx);
|
||||
}
|
||||
self.paint_text(text_bounds, &mut layout, cx);
|
||||
self.paint_background(gutter_bounds, text_bounds, &layout, cx);
|
||||
if layout.gutter_size.width > Pixels::ZERO {
|
||||
self.paint_gutter(gutter_bounds, &mut layout, cx);
|
||||
}
|
||||
self.paint_text(text_bounds, &mut layout, cx);
|
||||
|
||||
cx.with_z_index(0, |cx| {
|
||||
self.paint_mouse_listeners(bounds, gutter_bounds, text_bounds, &layout, cx);
|
||||
});
|
||||
if !layout.blocks.is_empty() {
|
||||
cx.with_z_index(0, |cx| {
|
||||
cx.with_element_id(Some("editor_blocks"), |cx| {
|
||||
self.paint_blocks(bounds, &mut layout, cx);
|
||||
cx.with_z_index(0, |cx| {
|
||||
self.paint_mouse_listeners(
|
||||
bounds,
|
||||
gutter_bounds,
|
||||
text_bounds,
|
||||
&layout,
|
||||
cx,
|
||||
);
|
||||
});
|
||||
})
|
||||
}
|
||||
if !layout.blocks.is_empty() {
|
||||
cx.with_z_index(0, |cx| {
|
||||
cx.with_element_id(Some("editor_blocks"), |cx| {
|
||||
self.paint_blocks(bounds, &mut layout, cx);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
cx.with_z_index(1, |cx| {
|
||||
self.paint_overlays(text_bounds, &mut layout, cx);
|
||||
});
|
||||
cx.with_z_index(1, |cx| {
|
||||
self.paint_overlays(text_bounds, &mut layout, cx);
|
||||
});
|
||||
|
||||
cx.with_z_index(2, |cx| self.paint_scrollbar(bounds, &mut layout, cx));
|
||||
});
|
||||
})
|
||||
cx.with_z_index(2, |cx| self.paint_scrollbar(bounds, &mut layout, cx));
|
||||
});
|
||||
})
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -478,7 +478,6 @@ impl InfoPopover {
|
|||
div()
|
||||
.id("info_popover")
|
||||
.elevation_2(cx)
|
||||
.text_ui()
|
||||
.p_2()
|
||||
.overflow_y_scroll()
|
||||
.max_w(max_size.width)
|
||||
|
@ -555,7 +554,6 @@ impl DiagnosticPopover {
|
|||
.px_2()
|
||||
.py_1()
|
||||
.bg(diagnostic_colors.background)
|
||||
.text_ui()
|
||||
.text_color(diagnostic_colors.text)
|
||||
.border_1()
|
||||
.border_color(diagnostic_colors.border)
|
||||
|
|
Loading…
Reference in a new issue