Skip to content

Commit

Permalink
When clicking on a hunk expand it, do not move the caret (#11350)
Browse files Browse the repository at this point in the history
Release Notes:

- N/A
  • Loading branch information
SomeoneToIgnore committed May 3, 2024
1 parent 3605550 commit f5e155b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions crates/editor/src/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,12 @@ impl EditorElement {
let mut click_count = event.click_count;
let mut modifiers = event.modifiers;

if gutter_hitbox.is_hovered(cx) {
click_count = 3; // Simulate triple-click when clicking the gutter to select lines
} else if let Some(hovered_hunk) = hovered_hunk {
if let Some(hovered_hunk) = hovered_hunk {
editor.expand_diff_hunk(None, hovered_hunk, cx);
cx.notify();
return;
} else if gutter_hitbox.is_hovered(cx) {
click_count = 3; // Simulate triple-click when clicking the gutter to select lines
} else if !text_hitbox.is_hovered(cx) {
return;
}
Expand Down

0 comments on commit f5e155b

Please sign in to comment.