From 764a2755e259eb090ade88fe328e302a7c53f457 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Fri, 22 Dec 2023 22:56:35 +0200 Subject: [PATCH] Fix multibuffer scroll by reordering z-index of its elements 1. Blocks (with their headers) and mouse listeners should be drawn together otherwise either starts to loose mouse events. 2. Scrollbar should be above all to match zed1 look and avoid buffer headers popping slightly to the right of the scrollbar. --- crates/editor2/src/element.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/crates/editor2/src/element.rs b/crates/editor2/src/element.rs index 294cc2c4e3eeb96921c6e339b12cfb426a9b6661..9e1d8e641f0964319e123476fa608484ce6320ea 100644 --- a/crates/editor2/src/element.rs +++ b/crates/editor2/src/element.rs @@ -2840,23 +2840,26 @@ impl Element for EditorElement { } 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); - }); - - cx.with_z_index(1, |cx| self.paint_scrollbar(bounds, &mut layout, cx)); - if !layout.blocks.is_empty() { - cx.with_z_index(2, |cx| { + cx.with_z_index(0, |cx| { cx.with_element_id(Some("editor_blocks"), |cx| { self.paint_blocks(bounds, &mut layout, cx); + self.paint_mouse_listeners( + bounds, + gutter_bounds, + text_bounds, + &layout, + cx, + ); }); }) } - cx.with_z_index(3, |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)); }); }) }