Fix bugs with applying hunks from branch buffers (#18721)
Release Notes: - N/A --------- Co-authored-by: Marshall <marshall@zed.dev>
This commit is contained in:
parent
3c91184726
commit
b0a16a7601
4 changed files with 128 additions and 61 deletions
|
@ -1430,16 +1430,22 @@ impl Buffer {
|
|||
counts.insert(edit_id, self.undo_map.undo_count(edit_id) + 1);
|
||||
}
|
||||
|
||||
let operation = self.undo_operations(counts);
|
||||
self.history.push(operation.clone());
|
||||
operation
|
||||
}
|
||||
|
||||
pub fn undo_operations(&mut self, counts: HashMap<clock::Lamport, u32>) -> Operation {
|
||||
let timestamp = self.lamport_clock.tick();
|
||||
let version = self.version();
|
||||
self.snapshot.version.observe(timestamp);
|
||||
let undo = UndoOperation {
|
||||
timestamp: self.lamport_clock.tick(),
|
||||
version: self.version(),
|
||||
timestamp,
|
||||
version,
|
||||
counts,
|
||||
};
|
||||
self.apply_undo(&undo);
|
||||
self.snapshot.version.observe(undo.timestamp);
|
||||
let operation = Operation::Undo(undo);
|
||||
self.history.push(operation.clone());
|
||||
operation
|
||||
Operation::Undo(undo)
|
||||
}
|
||||
|
||||
pub fn push_transaction(&mut self, transaction: Transaction, now: Instant) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue