From 2b28ce94be5442092958dddad0a8d457a5706bf4 Mon Sep 17 00:00:00 2001 From: Nikita Revenco <154856872+NikitaRevenco@users.noreply.github.com> Date: Mon, 9 Dec 2024 14:23:59 +0000 Subject: [PATCH] fix: do not use a Cell for self.active --- helix-term/src/handlers/diagnostics.rs | 4 +--- helix-view/src/handlers/diagnostics.rs | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/helix-term/src/handlers/diagnostics.rs b/helix-term/src/handlers/diagnostics.rs index 70e8ecc2a..3e44d416d 100644 --- a/helix-term/src/handlers/diagnostics.rs +++ b/helix-term/src/handlers/diagnostics.rs @@ -17,9 +17,7 @@ pub(super) fn register_hooks(_handlers: &Handlers) { }); register_hook!(move |event: &mut OnModeSwitch<'_, '_>| { for (view, _) in event.cx.editor.tree.views_mut() { - view.diagnostics_handler - .active - .set(event.new_mode != Mode::Insert); + view.diagnostics_handler.active = event.new_mode != Mode::Insert; } Ok(()) }); diff --git a/helix-view/src/handlers/diagnostics.rs b/helix-view/src/handlers/diagnostics.rs index e582197db..ebf4e4faa 100644 --- a/helix-view/src/handlers/diagnostics.rs +++ b/helix-view/src/handlers/diagnostics.rs @@ -59,7 +59,7 @@ pub struct DiagnosticsHandler { generation: Cell, last_doc: Cell, last_cursor_line: Cell, - pub active: Cell, + pub active: bool, pub events: Sender, } @@ -69,7 +69,7 @@ pub struct DiagnosticsHandler { // but to fix that larger architecutre changes are needed impl Clone for DiagnosticsHandler { fn clone(&self) -> Self { - Self::new(self.active.take()) + Self::new(self.active) } }