mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-12 08:52:26 +00:00
Undo: the open documents' histories share one budget of a quarter of installed memory
`Session::history_budget` (default `default_history_budget()`) caps the memory the undo steps of all open documents keep together. After each command, tool edit, interaction commit, direct edit, framed script run and closed undo group, `Session::trim_histories` drops the oldest steps of any document first, undo steps before redo steps. Each document keeps its last eight undo steps and next eight redo steps, and a held history keeps all of its steps. While a script runs or an undo group is open, no steps are dropped, so a canceled group leaves the other documents' steps in place. Closing a document frees its share. The steps are not counted again while neither the budget nor any history changed. Each document's own `byte_budget` stays as its ceiling.
This commit is contained in:
@@ -1021,7 +1021,11 @@ impl Session {
|
||||
self.script_key = Some(key);
|
||||
None
|
||||
}
|
||||
Ok(Ok(Progress::Done(_))) => Some(self.script_commit(job)),
|
||||
Ok(Ok(Progress::Done(_))) => {
|
||||
let r = self.script_commit(job);
|
||||
self.trim_histories();
|
||||
Some(r)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user