Paint code-action/fold buttons above the gutter

This commit is contained in:
Max Brunsfeld 2023-12-09 11:41:40 -08:00
parent 188d727d31
commit 7b722c326f

View file

@ -749,6 +749,7 @@ impl EditorElement {
} }
} }
cx.with_z_index(1, |cx| {
for (ix, fold_indicator) in layout.fold_indicators.drain(..).enumerate() { for (ix, fold_indicator) in layout.fold_indicators.drain(..).enumerate() {
if let Some(mut fold_indicator) = fold_indicator { if let Some(mut fold_indicator) = fold_indicator {
let mut fold_indicator = fold_indicator.into_any_element(); let mut fold_indicator = fold_indicator.into_any_element();
@ -763,7 +764,8 @@ impl EditorElement {
ix as f32 * line_height - (scroll_top % line_height), ix as f32 * line_height - (scroll_top % line_height),
); );
let centering_offset = point( let centering_offset = point(
(layout.gutter_padding + layout.gutter_margin - fold_indicator_size.width) / 2., (layout.gutter_padding + layout.gutter_margin - fold_indicator_size.width)
/ 2.,
(line_height - fold_indicator_size.height) / 2., (line_height - fold_indicator_size.height) / 2.,
); );
let origin = bounds.origin + position + centering_offset; let origin = bounds.origin + position + centering_offset;
@ -787,6 +789,7 @@ impl EditorElement {
button.draw(bounds.origin + point(x, y), available_space, cx); button.draw(bounds.origin + point(x, y), available_space, cx);
} }
});
} }
fn paint_diff_hunks(bounds: Bounds<Pixels>, layout: &LayoutState, cx: &mut WindowContext) { fn paint_diff_hunks(bounds: Bounds<Pixels>, layout: &LayoutState, cx: &mut WindowContext) {