From 536a958c58fbc4964a943bf9ffba8eed051d3232 Mon Sep 17 00:00:00 2001 From: Aaron Feickert <66188213+AaronFeickert@users.noreply.github.com> Date: Thu, 19 Dec 2024 10:24:30 -0600 Subject: [PATCH] Fix cursor overlap (#21999) When the cursor has a block shape and is not on the first line, its name popup exhibits an overlap: Screenshot 2024-12-13 at 18 00 54 This occurs because the popup's horizontal alignment is set differently when the cursor [is](https://github.com/zed-industries/zed/blob/fff12ec1e5278e1825d912241f62179387ac8176/crates/editor/src/element.rs#L6383) or [isn't](https://github.com/zed-industries/zed/blob/fff12ec1e5278e1825d912241f62179387ac8176/crates/editor/src/element.rs#L6385) on the first line. This PR makes the horizontal alignment the same in both cases, which removes the overlap: Screenshot 2024-12-13 at 17 57 20 Closes #21887. Release Notes: - Fixed an overlap that cuts off user names when a cursor has a block shape. --- crates/editor/src/element.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 343102b99e..69ee6a74ea 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -7023,7 +7023,16 @@ impl CursorLayout { let name_origin = if cursor_name.is_top_row { point(bounds.right() - px(1.), bounds.top()) } else { - point(bounds.left(), bounds.top() - text_size / 2. - px(1.)) + match self.shape { + CursorShape::Bar => point( + bounds.right() - px(2.), + bounds.top() - text_size / 2. - px(1.), + ), + _ => point( + bounds.right() - px(1.), + bounds.top() - text_size / 2. - px(1.), + ), + } }; let mut name_element = div() .bg(self.color)