pub enum DocumentEvent {
ContentsChanged {
position: usize,
chars_removed: usize,
chars_added: usize,
blocks_affected: usize,
},
FormatChanged {
position: usize,
length: usize,
},
BlockCountChanged(usize),
DocumentReset,
UndoRedoChanged {
can_undo: bool,
can_redo: bool,
},
ModificationChanged(bool),
LongOperationProgress {
operation_id: String,
percent: f64,
message: String,
},
LongOperationFinished {
operation_id: String,
success: bool,
error: Option<String>,
},
}Expand description
Events emitted by a TextDocument.
Subscribe via TextDocument::on_change (callback-based)
or poll via TextDocument::poll_events (frame-loop).
These events carry enough information for a UI to do incremental updates — repaint only the affected region, not the entire document.
Variants§
ContentsChanged
Text content changed at a specific region.
Emitted by: insert_text, delete_char, delete_previous_char,
remove_selected_text, insert_formatted_text, insert_block,
insert_html, insert_markdown, insert_fragment, insert_image.
FormatChanged
Formatting changed without text content change.
BlockCountChanged(usize)
Block count changed. Carries the new count.
DocumentReset
The document was completely replaced (import, clear).
UndoRedoChanged
Undo/redo was performed or availability changed.
ModificationChanged(bool)
The modified flag changed.
LongOperationProgress
A long operation progressed.
LongOperationFinished
A long operation completed or failed.
Trait Implementations§
Source§impl Clone for DocumentEvent
impl Clone for DocumentEvent
Source§fn clone(&self) -> DocumentEvent
fn clone(&self) -> DocumentEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more