pub struct Shift { /* private fields */ }Expand description
The accumulated effect of edits already applied, in original coordinates.
Column shifts apply only to positions on the line where the last edit ended; line shifts apply to everything after it. Tracking both is what lets several cursors edit the same line without the later ones landing in the wrong place.
Implementations§
Source§impl Shift
impl Shift
Sourcepub fn apply(&self, pos: Position) -> Position
pub fn apply(&self, pos: Position) -> Position
Where pos — stated in the coordinates that existed before this batch —
sits now.
Sourcepub fn record(
&mut self,
original_end_line: usize,
applied_end: Position,
after: Position,
)
pub fn record( &mut self, original_end_line: usize, applied_end: Position, after: Position, )
Record what an edit did.
original_end_line is in original coordinates; applied_end and after
are in current ones — applied_end is where the edit’s range ended once
the shift so far was applied, and after is where the replacement text
left the position.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Shift
impl RefUnwindSafe for Shift
impl Send for Shift
impl Sync for Shift
impl Unpin for Shift
impl UnsafeUnpin for Shift
impl UnwindSafe for Shift
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more