diff options
author | Blaž Hrastnik | 2021-11-06 15:28:19 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-11-06 15:28:19 +0000 |
commit | f2b709a3c3a9cc036bfea46734efd7e4100eb34b (patch) | |
tree | ad5f921f13659e5ba395442e13389af317ee81b0 /helix-core/src/transaction.rs | |
parent | cde57dae356021c6ca8c2a2ed68777bd9d0bc0b2 (diff) | |
parent | f979bdc442ab3150a369ff8bee0703e90e32e2a4 (diff) |
Merge branch 'master' into debug
Diffstat (limited to 'helix-core/src/transaction.rs')
-rw-r--r-- | helix-core/src/transaction.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/helix-core/src/transaction.rs b/helix-core/src/transaction.rs index d682f058..dfc18fbe 100644 --- a/helix-core/src/transaction.rs +++ b/helix-core/src/transaction.rs @@ -132,6 +132,9 @@ impl ChangeSet { if self.changes.is_empty() { return other; } + if other.changes.is_empty() { + return self; + } let len = self.changes.len(); @@ -465,6 +468,13 @@ impl Transaction { } } + pub fn compose(mut self, other: Self) -> Self { + self.changes = self.changes.compose(other.changes); + // Other selection takes precedence + self.selection = other.selection; + self + } + pub fn with_selection(mut self, selection: Selection) -> Self { self.selection = Some(selection); self |