summaryrefslogtreecommitdiff
path: root/helix-core/src/transaction.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-09-13 11:04:16 +0000
committerBlaž Hrastnik2020-09-13 11:04:16 +0000
commitb08278807ee51e279c07dd6b7955713455a4c654 (patch)
tree796ea4ecc8b316b4a1ecaa52122af7e5d9dc37f6 /helix-core/src/transaction.rs
parentfb0f56b7472d221e57b2bec13c9c8668fe673e77 (diff)
Add 'A', 'I' commands.
Diffstat (limited to 'helix-core/src/transaction.rs')
-rw-r--r--helix-core/src/transaction.rs8
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