From b4fc8ea6f7bdd014bd321f49b4de3904392cfb9f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 11 Dec 2023 14:21:55 +0100 Subject: [PATCH] Fix porting mistake that caused clicking on the editor to misbehave We used `width` instead of `height` in the "pixels-to-point" conversion code, which would cause clicks to not work correctly when the width was smaller than the `y` coordinate. --- crates/editor2/src/element.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/editor2/src/element.rs b/crates/editor2/src/element.rs index 4e444ee18924aea6053fdb5553f0b941e12ef6db..01eec607cd00947249e728e503269e23953023c9 100644 --- a/crates/editor2/src/element.rs +++ b/crates/editor2/src/element.rs @@ -2950,7 +2950,7 @@ impl PositionMap { ) -> PointForPosition { let scroll_position = self.snapshot.scroll_position(); let position = position - text_bounds.origin; - let y = position.y.max(px(0.)).min(self.size.width); + let y = position.y.max(px(0.)).min(self.size.height); let x = position.x + (scroll_position.x * self.em_width); let row = (f32::from(y / self.line_height) + scroll_position.y) as u32;