diff options
Diffstat (limited to 'helix-core/src/transaction.rs')
-rw-r--r-- | helix-core/src/transaction.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/helix-core/src/transaction.rs b/helix-core/src/transaction.rs index 3d03de19..12ed523e 100644 --- a/helix-core/src/transaction.rs +++ b/helix-core/src/transaction.rs @@ -322,6 +322,14 @@ pub struct Transaction { } impl Transaction { + /// Create a new, empty transaction. + pub fn new(state: &mut State) -> Self { + Self { + changes: ChangeSet::new(&state.doc), + selection: None, + } + } + /// Returns true if applied successfully. pub fn apply(&self, state: &mut State) -> bool { // apply changes to the document |