Simplify undo_to_transaction and redo_to_transaction

We don't need to mutate the history anymore now that we render pending renames
with a block decoration.
This commit is contained in:
Antonio Scandurra
2022-02-19 10:52:21 +01:00
parent b573a39cbc
commit cf7cc83f85
4 changed files with 29 additions and 141 deletions
+2 -4
View File
@@ -1738,13 +1738,12 @@ impl Buffer {
pub fn undo_to_transaction(
&mut self,
transaction_id: TransactionId,
push_redo: bool,
cx: &mut ModelContext<Self>,
) -> bool {
let was_dirty = self.is_dirty();
let old_version = self.version.clone();
let operations = self.text.undo_to_transaction(transaction_id, push_redo);
let operations = self.text.undo_to_transaction(transaction_id);
let undone = !operations.is_empty();
for operation in operations {
self.send_operation(Operation::Buffer(operation), cx);
@@ -1771,13 +1770,12 @@ impl Buffer {
pub fn redo_to_transaction(
&mut self,
transaction_id: TransactionId,
push_undo: bool,
cx: &mut ModelContext<Self>,
) -> bool {
let was_dirty = self.is_dirty();
let old_version = self.version.clone();
let operations = self.text.redo_to_transaction(transaction_id, push_undo);
let operations = self.text.redo_to_transaction(transaction_id);
let redone = !operations.is_empty();
for operation in operations {
self.send_operation(Operation::Buffer(operation), cx);