File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
CodeEdit/Features/Editor/Models/Restoration Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,19 @@ import CodeEditTextView
1010
1111/// Very simple class for registering undo manager for files for a project session. This does not do any saving, it
1212/// just stores the undo managers in memory and retrieves them as necessary for files.
13+ ///
14+ /// Undo stacks aren't stored on `CEWorkspaceFile` or `CodeFileDocument` because:
15+ /// - `CEWorkspaceFile` can be refreshed and reloaded at any point.
16+ /// - `CodeFileDocument` is released once there are no editors viewing it.
17+ /// Undo stacks need to be retained for the duration of a workspace session, enduring editor closes..
1318final class UndoManagerRegistration : ObservableObject {
1419 private var managerMap : [ CEWorkspaceFile . ID : CEUndoManager ] = [ : ]
1520
1621 init ( ) { }
17-
22+
23+ /// Find or create a new undo manager.
24+ /// - Parameter file: The file to create for.
25+ /// - Returns: The undo manager for the given file.
1826 func manager( forFile file: CEWorkspaceFile ) -> CEUndoManager {
1927 if let manager = managerMap [ file. id] {
2028 return manager
You can’t perform that action at this time.
0 commit comments