fix: do not use a Cell for self.active

This commit is contained in:
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<'_, '_>| {
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(())
});

View file

@ -59,7 +59,7 @@ pub struct DiagnosticsHandler {
generation: Cell<usize>,
last_doc: Cell<DocumentId>,
last_cursor_line: Cell<usize>,
pub active: Cell<bool>,
pub active: bool,
pub events: Sender<DiagnosticEvent>,
}
@ -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)
}
}