fix(workspace): settle only the conflict shown, keep what a choice replaces, desktop gaps of phase 5a

Review 2, phase 5a, fix round 1 (desktop and the engine side of Resolve and Restore).

- Resolve applies Keep mine / Take the library's only to the conflict the dialog listed:
  when the head or what differs moved since, the new conflict is recorded and asked again;
  Sync re-works a pending conflict instead of re-showing a stale list. Take the library's
  first saves uncommitted changes as a version, and the editor takes it as one undo step
  (toast Undo, Ctrl+Z) that brings back only the settings both changed.
- Restore saves unsaved changes as a version also while a conflict waits; a restore that
  changed nothing, or was undone, no longer marks the next version as a Restore.
- The editor's saves and merges of a workspace project merge positions photo by photo
  (portable form) and ask where both sides changed a setting, never deciding for ours.
- Read-only after a pull is signalled, and no save that can never be stored is left behind.
- The chip is read again after edits; a background conflict waits for the open dialog;
  Send first and Delete show the conflict they met; Discard changes needs the typed name.
- Open project... reaches the library's other projects (Save both's sibling, also from
  its toast); copies whose project or sequence is gone read Not in library and can be
  removed from the picker's Workspace rows; a delete whose local copy stays says so.
- A workspace folder inside a library is refused before anything is written.
- Conflict and Compare lines name heroes, exclusions and keyframes; History shows the PC
  name alone, never the program's prefixes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-03 10:22:17 +01:00
1 parent 50e28fd63d
commit 8027d84f7e
28 files changed
+1321 -134

No files matched your search

+9 -4
View File
@@ -9,7 +9,11 @@ namespace Chronos.App.Editor;
/// <see cref="EndRun"/> (the drag or key press ended); any other edit, undo or redo also ends the run. The oldest steps
/// are dropped beyond <see cref="Capacity"/>.
/// </summary>
public sealed class ProjectHistory(ProjectSettings initial, int capacity = 200)
/// <param name="merge">
/// The three-way merge (basis, ours, theirs) that gives each step an outside change (<see cref="Replace"/>): the source's,
/// which merges a workspace project's frame positions photo by photo; <see cref="ProjectMerge.Merge"/> when null.
/// </param>
public sealed class ProjectHistory(ProjectSettings initial, int capacity = 200, Func<ProjectSettings, ProjectSettings, ProjectSettings, ProjectSettings>? merge = null)
{
private readonly LinkedList<ProjectSettings> _undo = new();
private readonly LinkedList<ProjectSettings> _redo = new();
@@ -71,7 +75,8 @@ public sealed class ProjectHistory(ProjectSettings initial, int capacity = 200)
{
ArgumentNullException.ThrowIfNull(current);
if (ProjectMerge.SameValues(current, Current)) return;
var rebase = new ProjectMerge.Rebase(Current, current);
var (basis, theirs) = (Current, current);
Func<ProjectSettings, ProjectSettings> rebase = merge is null ? new ProjectMerge.Rebase(basis, theirs).Apply : step => merge(basis, step, theirs);
Rebase(_undo, rebase);
Rebase(_redo, rebase);
_runKey = null;
@@ -98,9 +103,9 @@ public sealed class ProjectHistory(ProjectSettings initial, int capacity = 200)
Changed?.Invoke();
}
private static void Rebase(LinkedList<ProjectSettings> steps, ProjectMerge.Rebase rebase)
private static void Rebase(LinkedList<ProjectSettings> steps, Func<ProjectSettings, ProjectSettings> rebase)
{
for (var node = steps.First; node is not null; node = node.Next) node.Value = rebase.Apply(node.Value);
for (var node = steps.First; node is not null; node = node.Next) node.Value = rebase(node.Value);
}
private bool Move(ProjectSettings target)