diff --git a/crates/text/src/text.rs b/crates/text/src/text.rs index 30fd985319243c094a6e2a29995376b9fc16e8c4..2b2282474a81291a17ab9828c36df33270290b44 100644 --- a/crates/text/src/text.rs +++ b/crates/text/src/text.rs @@ -189,7 +189,7 @@ impl History { } } - fn group(&mut self) { + fn group(&mut self) -> Option { let mut new_len = self.undo_stack.len(); let mut transactions = self.undo_stack.iter_mut(); @@ -221,6 +221,7 @@ impl History { } self.undo_stack.truncate(new_len); + self.undo_stack.last().map(|t| t.id) } fn push_undo(&mut self, edit_id: clock::Local) { @@ -1081,9 +1082,8 @@ impl Buffer { pub fn end_transaction_at(&mut self, now: Instant) -> Option<(TransactionId, clock::Global)> { if let Some(transaction) = self.history.end_transaction(now) { - let id = transaction.id; let since = transaction.start.clone(); - self.history.group(); + let id = self.history.group().unwrap(); Some((id, since)) } else { None