From 41699224ff18f64ef71bcb91c3d3a0273470ed77 Mon Sep 17 00:00:00 2001 From: K Simmons Date: Wed, 26 Oct 2022 17:39:17 -0700 Subject: [PATCH 1/2] fix typo in blink manager disable which didn't properly disable, and start editors with the blink manager disabled --- crates/editor/src/blink_manager.rs | 7 ++++--- crates/editor/src/editor.rs | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/editor/src/blink_manager.rs b/crates/editor/src/blink_manager.rs index 77d10534d2..ff6d1c2fcc 100644 --- a/crates/editor/src/blink_manager.rs +++ b/crates/editor/src/blink_manager.rs @@ -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.enabled = true; + pub fn disable(&mut self, cx: &mut ModelContext) { + self.enabled = false; } pub fn visible(&self) -> bool { diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 387920d81e..32e58a5d82 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -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() { From c093516351faeb3fb6df2697895a2f35641a04bc Mon Sep 17 00:00:00 2001 From: K Simmons Date: Wed, 26 Oct 2022 17:42:03 -0700 Subject: [PATCH 2/2] fix minor warning --- crates/editor/src/blink_manager.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/editor/src/blink_manager.rs b/crates/editor/src/blink_manager.rs index ff6d1c2fcc..df66ec2125 100644 --- a/crates/editor/src/blink_manager.rs +++ b/crates/editor/src/blink_manager.rs @@ -97,7 +97,7 @@ impl BlinkManager { self.blink_cursors(self.blink_epoch, cx); } - pub fn disable(&mut self, cx: &mut ModelContext) { + pub fn disable(&mut self, _cx: &mut ModelContext) { self.enabled = false; }