Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

When clicking on a hunk expand it, do not move the caret (#11350)

Kirill Bulatovf5e155b5a9d9
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs
index eda06a95c9d..9c925b4b004 100644
--- a/crates/editor/src/element.rs
+++ b/crates/editor/src/element.rs
@@ -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;
}