From 2671b9c63ce057f8200671c8488b9152f59d5309 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Wed, 8 May 2024 14:16:34 +0200 Subject: [PATCH] Fix alignment of code actions menu with narrow panes --- crates/editor/src/element.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 10d5f821142cf272ce470c15a19a8fd7378c5894..dd327d503b1927846e0e34da7c3d18f785611d22 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -2082,6 +2082,10 @@ impl EditorElement { crate::ContextMenuOrigin::GutterIndicator(row) => { // Context menu was spawned via a click on a gutter. Ensure it's a bit closer to the indicator than just a plain first column of the // text field. + let snapshot = self.editor.update(cx, |this, cx| this.snapshot(cx)); + let row = Point::new(row, 0) + .to_display_point(&snapshot.display_snapshot) + .row(); let x = -gutter_overshoot; let y = (row + 1) as f32 * line_height - scroll_pixel_position.y; (x, y)