From bdea804c48c62812a221ddcaca9c8e397a079908 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Mon, 25 Mar 2024 12:41:54 -0700 Subject: [PATCH] Restore the hitbox of the excerpt header (#9790) In https://github.com/zed-industries/zed/pull/9722, the jump-to-excerpt-source buttons where shrunk too far. Release Notes: - N/A --- crates/editor/src/element.rs | 64 +++++++++++++++++------------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 65ce5dbca9..3a30bddbbc 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -1497,47 +1497,17 @@ impl EditorElement { .v_flex() .justify_start() .id("jump to collapsed context") - .group("") .w(relative(1.0)) .h_full() - .cursor_pointer() .child( div() .h_px() .w_full() .bg(cx.theme().colors().border_variant) - .group_hover("", |style| { + .group_hover("excerpt-jump-action", |style| { style.bg(cx.theme().colors().border) }), - ) - .when_some(jump_data.clone(), |this, jump_data| { - this.on_click(cx.listener_for(&self.editor, { - let path = jump_data.path.clone(); - move |editor, _, cx| { - cx.stop_propagation(); - - editor.jump( - path.clone(), - jump_data.position, - jump_data.anchor, - cx, - ); - } - })) - .tooltip( - move |cx| { - Tooltip::for_action( - format!( - "Jump to {}:L{}", - jump_data.path.path.display(), - jump_data.position.row + 1 - ), - &OpenExcerpts, - cx, - ) - }, - ) - }), + ), ) .child( h_flex() @@ -1555,7 +1525,7 @@ impl EditorElement { .path(IconName::ArrowUpRight.path()) .size(IconSize::XSmall.rems()) .text_color(cx.theme().colors().border) - .group_hover("", |style| { + .group_hover("excerpt-jump-action", |style| { style.text_color( cx.theme().colors().editor_line_number, ) @@ -1589,6 +1559,34 @@ impl EditorElement { }), ), ) + .group("excerpt-jump-action") + .cursor_pointer() + .when_some(jump_data.clone(), |this, jump_data| { + this.on_click(cx.listener_for(&self.editor, { + let path = jump_data.path.clone(); + move |editor, _, cx| { + cx.stop_propagation(); + + editor.jump( + path.clone(), + jump_data.position, + jump_data.anchor, + cx, + ); + } + })) + .tooltip(move |cx| { + Tooltip::for_action( + format!( + "Jump to {}:L{}", + jump_data.path.path.display(), + jump_data.position.row + 1 + ), + &OpenExcerpts, + cx, + ) + }) + }) }; element.into_any() }