fix: do not use a Cell for self.active

pull/12203/head
Nikita Revenco 2024-12-09 14:23:59 +00:00
parent 069ca339a6
commit 2b28ce94be
2 changed files with 3 additions and 5 deletions

View File

@ -17,9 +17,7 @@ pub(super) fn register_hooks(_handlers: &Handlers) {
}); });
register_hook!(move |event: &mut OnModeSwitch<'_, '_>| { register_hook!(move |event: &mut OnModeSwitch<'_, '_>| {
for (view, _) in event.cx.editor.tree.views_mut() { for (view, _) in event.cx.editor.tree.views_mut() {
view.diagnostics_handler view.diagnostics_handler.active = event.new_mode != Mode::Insert;
.active
.set(event.new_mode != Mode::Insert);
} }
Ok(()) Ok(())
}); });

View File

@ -59,7 +59,7 @@ pub struct DiagnosticsHandler {
generation: Cell<usize>, generation: Cell<usize>,
last_doc: Cell<DocumentId>, last_doc: Cell<DocumentId>,
last_cursor_line: Cell<usize>, last_cursor_line: Cell<usize>,
pub active: Cell<bool>, pub active: bool,
pub events: Sender<DiagnosticEvent>, pub events: Sender<DiagnosticEvent>,
} }
@ -69,7 +69,7 @@ pub struct DiagnosticsHandler {
// but to fix that larger architecutre changes are needed // but to fix that larger architecutre changes are needed
impl Clone for DiagnosticsHandler { impl Clone for DiagnosticsHandler {
fn clone(&self) -> Self { fn clone(&self) -> Self {
Self::new(self.active.take()) Self::new(self.active)
} }
} }