Profile editor - Fix undo and editor service bugs found by the tests (#913)

* Profile editor - Fix undoing profile editor commands

- Undoing a change to an existing keyframe's value restores the value instead of deleting the keyframe
- Undoing "remove effect" puts the effect back in its place instead of below the next one
- Undoing "toggle keyframes" restores what it was before
- Undoing a brush change on a layer that had no brush removes the brush again, using the new Layer.RemoveLayerBrush
- Undoing "add element" disables the element again
- Undoing an event path change back to no path goes back to an event start node, like a new condition
- MoveProfileElement says "Move folder" for folders
- UpdateLayerProperty without a time no longer calls itself "Add ... keyframe"

* Profile editor - Fix auto-saving, failing commands, suspended editing and smaller editor issues

- A failed auto-save no longer stops auto-saving for the rest of the session
- A failing command is no longer also reported to ReactiveUI as unhandled, on top of the error dialog
- Resuming editing applies the editor's time again right away
- Nothing is focused while editing is suspended
- A layer created on another layer gets a name that isn't in use next to it
- CanUndo and CanRedo start out false, so new subscribers know the state right away
- An empty command scope doesn't add an undo step
- New subscribers to History get the current history once
- Expanding the keyframe selection with an already selected keyframe doesn't add it twice
- Snapping can snap to a snap time of zero
This commit is contained in:
RobertBeekman authored and GitHub committed 2026-10-24 16:17:05 +02:00
1 parent 63186ee06d
commit 295038f338
22 files changed
+140 -133

No files matched your search

@@ -131,7 +131,7 @@ public class ProfileEditorTimeTests : ProfileEditorTestBase
}
[Fact]
public async Task ResumingEditing_TakesBackControlButLeavesTheTimelinesAtTheStart()
public async Task ResumingEditing_TakesBackControlAndAppliesTheTime()
{
Layer layer = AddLayer("Layer", null, LedId.Keyboard_A);
await StartEditing();
@@ -142,13 +142,7 @@ public class ProfileEditorTimeTests : ProfileEditorTestBase
Current(Service.SuspendedEditing).ShouldBeFalse();
ProfileService.UpdateFocusProfile.ShouldBeFalse();
// Pinned as-is: resuming calls Tick to apply the editor's time again, but does so before marking editing as
// resumed, and Tick skips suspended editing. So the profile stays where suspending left it (at the start) until
// the time changes, while the editor shows 2 seconds
layer.Timeline.Position.ShouldBe(TimeSpan.Zero);
Current(Service.Time).ShouldBe(TimeSpan.FromSeconds(2));
Service.ChangeTime(TimeSpan.FromSeconds(2));
layer.Timeline.Position.ShouldBe(TimeSpan.FromSeconds(2));
}