mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-28 21:03:51 +03:00
Merge pull request #1823 from zed-industries/reduce-cursor-blink-load
Reduce Cursor Blink CPU Load
This commit is contained in:
commit
aa9ccf3411
@ -30,7 +30,7 @@ impl BlinkManager {
|
||||
blink_epoch: 0,
|
||||
blinking_paused: false,
|
||||
visible: true,
|
||||
enabled: true,
|
||||
enabled: false,
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,6 +71,7 @@ impl BlinkManager {
|
||||
if epoch == self.blink_epoch && self.enabled && !self.blinking_paused {
|
||||
self.visible = !self.visible;
|
||||
cx.notify();
|
||||
dbg!(cx.handle());
|
||||
|
||||
let epoch = self.next_blink_epoch();
|
||||
let interval = self.blink_interval;
|
||||
@ -96,8 +97,8 @@ impl BlinkManager {
|
||||
self.blink_cursors(self.blink_epoch, cx);
|
||||
}
|
||||
|
||||
pub fn disable(&mut self, _: &mut ModelContext<Self>) {
|
||||
self.enabled = true;
|
||||
pub fn disable(&mut self, _cx: &mut ModelContext<Self>) {
|
||||
self.enabled = false;
|
||||
}
|
||||
|
||||
pub fn visible(&self) -> bool {
|
||||
|
@ -6511,8 +6511,10 @@ impl View for Editor {
|
||||
if let Some(rename) = self.pending_rename.as_ref() {
|
||||
cx.focus(&rename.editor);
|
||||
} else {
|
||||
if !self.focused {
|
||||
self.blink_manager.update(cx, BlinkManager::enable);
|
||||
}
|
||||
self.focused = true;
|
||||
self.blink_manager.update(cx, BlinkManager::enable);
|
||||
self.buffer.update(cx, |buffer, cx| {
|
||||
buffer.finalize_last_transaction(cx);
|
||||
if self.leader_replica_id.is_none() {
|
||||
|
Loading…
Reference in New Issue
Block a user