workspace: Prevent user from undoing persistent session deserialization (#25106)
Closes #21846 Release Notes: - Fixed a bug that made it possible to undo changes in dirty deserialized buffer (with `restore_unsaved_buffers: true`)
This commit is contained in:
parent
e5d8bd27da
commit
f606b0641e
1 changed files with 6 additions and 0 deletions
|
@ -1073,6 +1073,9 @@ impl SerializableItem for Editor {
|
|||
buffer.set_language(Some(language), cx);
|
||||
}
|
||||
buffer.set_text(contents, cx);
|
||||
if let Some(entry) = buffer.peek_undo_stack() {
|
||||
buffer.forget_transaction(entry.transaction_id());
|
||||
}
|
||||
})?;
|
||||
|
||||
cx.update(|window, cx| {
|
||||
|
@ -1127,6 +1130,9 @@ impl SerializableItem for Editor {
|
|||
);
|
||||
}
|
||||
buffer.set_text(buffer_text, cx);
|
||||
if let Some(entry) = buffer.peek_undo_stack() {
|
||||
buffer.forget_transaction(entry.transaction_id());
|
||||
}
|
||||
})?;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue