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.

go_to_line: Fix goto line + mouse click jumps to previous scroll position (#26362)

Smit Barmase5f159bc95ed1
diff --git a/crates/go_to_line/src/go_to_line.rs b/crates/go_to_line/src/go_to_line.rs
index 7b9ee6780e8..8a6294ab888 100644
--- a/crates/go_to_line/src/go_to_line.rs
+++ b/crates/go_to_line/src/go_to_line.rs
@@ -152,7 +152,10 @@ impl GoToLine {
cx: &mut Context<Self>,
) {
match event {
- editor::EditorEvent::Blurred => cx.emit(DismissEvent),
+ editor::EditorEvent::Blurred => {
+ self.prev_scroll_position.take();
+ cx.emit(DismissEvent)
+ }
editor::EditorEvent::BufferEdited { .. } => self.highlight_current_line(cx),
_ => {}
}