pub struct Change<'h, S = &'h str> { /* private fields */ }Expand description
A change in a buffer, with a start, taken text, and added text
If you acquired this Change from a BufferTracker::parts
call, you need not worry about adding it to the ranges that need
to be updated, as that has already been done.
Implementations§
Source§impl Change<'static, String>
impl Change<'static, String>
Source§impl<'h> Change<'h>
impl<'h> Change<'h>
Sourcepub fn to_string_change(&self) -> Change<'static, String>
pub fn to_string_change(&self) -> Change<'static, String>
Creates a Change<String> from a Change<&str>
Sourcepub fn str_insert(added_str: &'h str, start: Point) -> Self
pub fn str_insert(added_str: &'h str, start: Point) -> Self
Returns a new copyable Change from an insertion.
Source§impl<'s, S: Borrow<str>> Change<'s, S>
impl<'s, S: Borrow<str>> Change<'s, S>
Sourcepub fn line_range(&self, strs: &Strs) -> Range<Point>
pub fn line_range(&self, strs: &Strs) -> Range<Point>
Gets a Range<Point>, from the start to the end of the
affected lines
For example, if you make an edit that transforms lines 1..=3
to lines 1..=5, this function will return a Range that
starts at the beginning of line 1, and ends at the end of line
5.
§Note
This end of this range will come after the last \n,
which means that, in that example, said point would have a
Point::line value equal to 6, not 5, since it
represents both the end of line 5, and the beginning of line
6.
Sourcepub fn taken_range(&self) -> Range<Point>
pub fn taken_range(&self) -> Range<Point>
Returns the taken Range
Sourcepub fn added_range(&self) -> Range<Point>
pub fn added_range(&self) -> Range<Point>
Returns the added Range