mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 02:46:43 +00:00
Only debounce the cursor position in multibuffer excerpts (#21946)
Follow up to: https://github.com/zed-industries/zed/pull/20211 Release Notes: - Improved the performance of the cursor position indicator in single buffers
This commit is contained in:
parent
b3de19a6bd
commit
4eaa1c2514
1 changed files with 11 additions and 2 deletions
|
@ -48,8 +48,17 @@ impl CursorPosition {
|
||||||
) {
|
) {
|
||||||
let editor = editor.downgrade();
|
let editor = editor.downgrade();
|
||||||
self.update_position = cx.spawn(|cursor_position, mut cx| async move {
|
self.update_position = cx.spawn(|cursor_position, mut cx| async move {
|
||||||
if let Some(debounce) = debounce {
|
let is_singleton = editor
|
||||||
cx.background_executor().timer(debounce).await;
|
.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
|
editor
|
||||||
|
|
Loading…
Reference in a new issue