mirror of https://github.com/helix-editor/helix
refactor DocumentDidChange events
in the past DocumentDidChange and SelectionDidChange events were implemented in a simplistic manner to get a simple prototype out. However, if you want to use these events in more complex scenarios with interdependencies between the two handlers the system fell short. The `SelectionDidChange` event was dispatched before the DocumentDidChange (and not at all if the selection wasn't manually set) so any handlers that wants to track selection was not able to map their ranges yet. The reason for this was actually the way that apply_impl was structured. The function was slightly refactored to address these problems and enable moving other range mappings to event handlers.pull/9801/head
parent
2cf38ca29c
commit
80d520f469
@ -1,10 +1,16 @@
|
|||||||
use helix_core::Rope;
|
use helix_core::{ChangeSet, Rope};
|
||||||
use helix_event::events;
|
use helix_event::events;
|
||||||
|
|
||||||
use crate::{Document, DocumentId, Editor, ViewId};
|
use crate::{Document, DocumentId, Editor, ViewId};
|
||||||
|
|
||||||
events! {
|
events! {
|
||||||
DocumentDidChange<'a> { doc: &'a mut Document, view: ViewId, old_text: &'a Rope }
|
DocumentDidChange<'a> {
|
||||||
|
doc: &'a mut Document,
|
||||||
|
view: ViewId,
|
||||||
|
old_text: &'a Rope,
|
||||||
|
changes: &'a ChangeSet,
|
||||||
|
ghost_transaction: bool
|
||||||
|
}
|
||||||
SelectionDidChange<'a> { doc: &'a mut Document, view: ViewId }
|
SelectionDidChange<'a> { doc: &'a mut Document, view: ViewId }
|
||||||
DiagnosticsDidChange<'a> { editor: &'a mut Editor, doc: DocumentId }
|
DiagnosticsDidChange<'a> { editor: &'a mut Editor, doc: DocumentId }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue