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.

Only debounce the cursor position in multibuffer excerpts (#21946)

Mikayla Maki4eaa1c25146d
diff --git a/crates/go_to_line/src/cursor_position.rs b/crates/go_to_line/src/cursor_position.rs
index 2dc60475d35..65ef247b916 100644
--- a/crates/go_to_line/src/cursor_position.rs
+++ b/crates/go_to_line/src/cursor_position.rs
@@ -48,8 +48,17 @@ impl CursorPosition {
) {
let editor = editor.downgrade();
self.update_position = cx.spawn(|cursor_position, mut cx| async move {
- if let Some(debounce) = debounce {
- cx.background_executor().timer(debounce).await;
+ let is_singleton = editor
+ .update(&mut cx, |editor, cx| {
+ editor.buffer().read(cx).is_singleton()
+ })
+ .ok()
+ .unwrap_or(true);
+
+ if !is_singleton {
+ if let Some(debounce) = debounce {
+ cx.background_executor().timer(debounce).await;
+ }
}
editor