diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index d30ead9126b35e183ee1a16d9020ef5766eeedab..99a4743eb9d5e1ef8dfc99fbee7b2a74490c7356 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -6,9 +6,9 @@ use crate::{ EditDisplayMode, EditPrediction, Editor, EditorMode, EditorSettings, EditorSnapshot, EditorStyle, FILE_HEADER_HEIGHT, FocusedBlock, GutterDimensions, HalfPageDown, HalfPageUp, HandleInput, HoveredCursor, InlayHintRefreshReason, JumpData, LineDown, LineHighlight, LineUp, - MAX_LINE_LEN, MINIMAP_FONT_SIZE, MULTI_BUFFER_EXCERPT_HEADER_HEIGHT, OpenExcerpts, PageDown, - PageUp, PhantomBreakpointIndicator, Point, RowExt, RowRangeExt, SelectPhase, - SelectedTextHighlight, Selection, SelectionDragState, SizingBehavior, SoftWrap, + MAX_LINE_LEN, MINIMAP_FONT_SIZE, MULTI_BUFFER_EXCERPT_HEADER_HEIGHT, OpenExcerpts, + OpenExcerptsSplit, PageDown, PageUp, PhantomBreakpointIndicator, Point, RowExt, RowRangeExt, + SelectPhase, SelectedTextHighlight, Selection, SelectionDragState, SizingBehavior, SoftWrap, StickyHeaderExcerpt, ToPoint, ToggleFold, ToggleFoldAll, code_context_menus::{CodeActionsMenu, MENU_ASIDE_MAX_WIDTH, MENU_ASIDE_MIN_WIDTH, MENU_GAP}, display_map::{ @@ -4043,17 +4043,24 @@ impl EditorElement { ) .group_hover("", |div| div.underline()), ) - .on_click(window.listener_for(&self.editor, { - let jump_data = jump_data.clone(); - move |editor, e: &ClickEvent, window, cx| { - editor.open_excerpts_common( - Some(jump_data.clone()), - e.modifiers().secondary(), - window, - cx, - ); + .on_click({ + let focus_handle = focus_handle.clone(); + move |event, window, cx| { + if event.modifiers().secondary() { + focus_handle.dispatch_action( + &OpenExcerptsSplit, + window, + cx, + ); + } else { + focus_handle.dispatch_action( + &OpenExcerpts, + window, + cx, + ); + } } - })), + }), ) .when_some(parent_path, |then, path| { then.child(div().child(path).text_color( @@ -4069,24 +4076,36 @@ impl EditorElement { can_open_excerpts && is_selected && relative_path.is_some(), |el| { el.child( - Button::new("open-file", "Open File") + ButtonLike::new("open-file-button") .style(ButtonStyle::OutlinedGhost) - .key_binding(KeyBinding::for_action_in( - &OpenExcerpts, - &focus_handle, - cx, - )) - .on_click(window.listener_for(&self.editor, { - let jump_data = jump_data.clone(); - move |editor, e: &ClickEvent, window, cx| { - editor.open_excerpts_common( - Some(jump_data.clone()), - e.modifiers().secondary(), - window, + .child( + h_flex() + .gap_2p5() + .child(Label::new("Open file")) + .child(KeyBinding::for_action_in( + &OpenExcerpts, + &focus_handle, cx, - ); + )), + ) + .on_click({ + let focus_handle = focus_handle.clone(); + move |event, window, cx| { + if event.modifiers().secondary() { + focus_handle.dispatch_action( + &OpenExcerptsSplit, + window, + cx, + ); + } else { + focus_handle.dispatch_action( + &OpenExcerpts, + window, + cx, + ); + } } - })), + }), ) }, )