From 9ff238921fa5fe6dde8b9d5fbb88cdb63ceeb6cd Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 15 Nov 2023 18:29:53 +0100 Subject: [PATCH] Fix clicking on code action and fold indicators Co-Authored-By: Nathan Sobo --- crates/editor2/src/element.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/editor2/src/element.rs b/crates/editor2/src/element.rs index f5ea324050c7ed2ab677e64cd3833eafc0edaadc..eaaa2d2a2f5370f4c0bb9b2fcf184f2fb5135e7c 100644 --- a/crates/editor2/src/element.rs +++ b/crates/editor2/src/element.rs @@ -2451,6 +2451,12 @@ impl Element for EditorElement { // We call with_z_index to establish a new stacking context. cx.with_z_index(0, |cx| { cx.with_content_mask(Some(ContentMask { bounds }), |cx| { + // Paint mouse listeners first, so any elements we paint on top of the editor + // take precedence. + self.paint_mouse_listeners(bounds, gutter_bounds, text_bounds, &layout, cx); + let input_handler = ElementInputHandler::new(bounds, cx); + cx.handle_input(&editor.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, editor, cx); @@ -2460,11 +2466,6 @@ impl Element for EditorElement { if !layout.blocks.is_empty() { self.paint_blocks(bounds, &mut layout, editor, cx); } - - self.paint_mouse_listeners(bounds, gutter_bounds, text_bounds, &layout, cx); - - let input_handler = ElementInputHandler::new(bounds, cx); - cx.handle_input(&editor.focus_handle, input_handler); }); }); },