pub trait BufferEdit: Send {
// Required methods
fn insert_at(&mut self, pos: Pos, text: &str);
fn delete_range(&mut self, range: Range<Pos>);
fn replace_range(&mut self, range: Range<Pos>, replacement: &str);
// Provided method
fn replace_all(&mut self, text: &str) { ... }
}Expand description
Required Methods§
Sourcefn insert_at(&mut self, pos: Pos, text: &str)
fn insert_at(&mut self, pos: Pos, text: &str)
Insert text at pos. Implementations clamp out-of-range
positions to the document end.
Sourcefn delete_range(&mut self, range: Range<Pos>)
fn delete_range(&mut self, range: Range<Pos>)
Delete the half-open range.
Sourcefn replace_range(&mut self, range: Range<Pos>, replacement: &str)
fn replace_range(&mut self, range: Range<Pos>, replacement: &str)
Replace the half-open range with replacement.
Provided Methods§
Sourcefn replace_all(&mut self, text: &str)
fn replace_all(&mut self, text: &str)
Replace the entire buffer content with text. The cursor is
clamped to the surviving content. Used by :e! / undo
restore / snapshot replay where expressing “replace whole
buffer” via [replace_range] would require knowing the end
position. Default impl uses [replace_range] with a
best-effort end (u32::MAX / u32::MAX); the canonical
in-tree impl overrides it for a single-shot rebuild.