mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-29 12:38:02 +00:00
Fix editor selection issue (#4110)
Release Notes: - Fixes a bug where, editor selections would update in the wrong pane when split.
This commit is contained in:
commit
933fb87013
1 changed files with 5 additions and 4 deletions
|
@ -456,6 +456,7 @@ impl EditorElement {
|
||||||
event: &MouseUpEvent,
|
event: &MouseUpEvent,
|
||||||
position_map: &PositionMap,
|
position_map: &PositionMap,
|
||||||
text_bounds: Bounds<Pixels>,
|
text_bounds: Bounds<Pixels>,
|
||||||
|
interactive_bounds: &InteractiveBounds,
|
||||||
stacking_order: &StackingOrder,
|
stacking_order: &StackingOrder,
|
||||||
cx: &mut ViewContext<Editor>,
|
cx: &mut ViewContext<Editor>,
|
||||||
) {
|
) {
|
||||||
|
@ -466,7 +467,8 @@ impl EditorElement {
|
||||||
editor.select(SelectPhase::End, cx);
|
editor.select(SelectPhase::End, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !pending_nonempty_selections
|
if interactive_bounds.visibly_contains(&event.position, cx)
|
||||||
|
&& !pending_nonempty_selections
|
||||||
&& event.modifiers.command
|
&& event.modifiers.command
|
||||||
&& text_bounds.contains(&event.position)
|
&& text_bounds.contains(&event.position)
|
||||||
&& cx.was_top_layer(&event.position, stacking_order)
|
&& cx.was_top_layer(&event.position, stacking_order)
|
||||||
|
@ -2542,15 +2544,14 @@ impl EditorElement {
|
||||||
let interactive_bounds = interactive_bounds.clone();
|
let interactive_bounds = interactive_bounds.clone();
|
||||||
|
|
||||||
move |event: &MouseUpEvent, phase, cx| {
|
move |event: &MouseUpEvent, phase, cx| {
|
||||||
if phase == DispatchPhase::Bubble
|
if phase == DispatchPhase::Bubble {
|
||||||
&& interactive_bounds.visibly_contains(&event.position, cx)
|
|
||||||
{
|
|
||||||
editor.update(cx, |editor, cx| {
|
editor.update(cx, |editor, cx| {
|
||||||
Self::mouse_up(
|
Self::mouse_up(
|
||||||
editor,
|
editor,
|
||||||
event,
|
event,
|
||||||
&position_map,
|
&position_map,
|
||||||
text_bounds,
|
text_bounds,
|
||||||
|
&interactive_bounds,
|
||||||
&stacking_order,
|
&stacking_order,
|
||||||
cx,
|
cx,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue