aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/transaction.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-core/src/transaction.rs')
-rw-r--r--helix-core/src/transaction.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/helix-core/src/transaction.rs b/helix-core/src/transaction.rs
index c6be89ac..8da01c09 100644
--- a/helix-core/src/transaction.rs
+++ b/helix-core/src/transaction.rs
@@ -242,6 +242,13 @@ impl ChangeSet {
}
}
+ /// `true` when the set is empty.
+ #[inline]
+ pub fn is_empty(&self) -> bool {
+ let len = self.changes.len();
+ len == 0 || (len == 1 && self.changes[0] == Change::Retain(self.len))
+ }
+
/// Map a position through the changes.
///
/// `assoc` indicates which size to associate the position with. `Before` will keep the