Paint code-action/fold buttons above the gutter (#3576)

Previously, clicking on fold indicators or code action lightning bolts
wouldn't work - it would instead perform the normal gutter click handler
(selecting the clicked line).

By painting those indicators at a higher z-index, we ensure that the
indicators' click handlers are invoked instead.
This commit is contained in:
Max Brunsfeld 2023-12-09 11:56:07 -08:00 committed by GitHub
commit cbbb0d033e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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