pub struct EditTransaction {
pub buffer: BufferId,
pub base_version: Version,
pub changes: ChangeSet,
pub source: EditSource,
pub undo_group: UndoGroupId,
pub selection: Option<Selection>,
}Expand description
A change to one buffer, stamped with the revision it was authored against.
Fields§
§buffer: BufferId§base_version: Version§changes: ChangeSet§source: EditSource§undo_group: UndoGroupId§selection: Option<Selection>Where the cursor should end up. None means “derive it” — map the current
selection through changes, which is right for edits made somewhere else in the
document (an agent hunk, a formatter run) where the cursor should simply hold its
place.
ARCHITECTURE.md §8 calls this field a SelectionMap; mapping is the default
behaviour here, and the Some case exists because an author sometimes knows
better — after typing, the cursor belongs after the inserted text, which is not
something position mapping can infer.
Implementations§
Source§impl EditTransaction
impl EditTransaction
Sourcepub fn new(
buffer: BufferId,
base_version: Version,
changes: ChangeSet,
source: EditSource,
undo_group: UndoGroupId,
) -> Self
pub fn new( buffer: BufferId, base_version: Version, changes: ChangeSet, source: EditSource, undo_group: UndoGroupId, ) -> Self
A transaction from source against base_version, deriving the resulting
selection by mapping.
Sourcepub fn with_selection(self, selection: Selection) -> Self
pub fn with_selection(self, selection: Selection) -> Self
Pin the post-edit selection explicitly.
Sourcepub fn proposal(&self) -> Option<ProposalId>
pub fn proposal(&self) -> Option<ProposalId>
The proposal this edit came from, if any.
Trait Implementations§
Source§impl Clone for EditTransaction
impl Clone for EditTransaction
Source§fn clone(&self) -> EditTransaction
fn clone(&self) -> EditTransaction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more