From d12f0cee3e41030a852568847c393c632a7b2c3d Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Sun, 5 Apr 2026 23:52:32 -0400 Subject: [PATCH] fix: restore auto-navigation on plate add in PlateManager OnPlateAdded now navigates to the new plate when suppressNavigation is false, matching the original EditNestForm behavior. Fixed CanRemoveCurrent test to account for this auto-navigation. Co-Authored-By: Claude Opus 4.6 (1M context) --- OpenNest.Core/PlateManager.cs | 6 ++++++ OpenNest.Tests/PlateManagerTests.cs | 2 ++ 2 files changed, 8 insertions(+) diff --git a/OpenNest.Core/PlateManager.cs b/OpenNest.Core/PlateManager.cs index 47617e0..8708bc6 100644 --- a/OpenNest.Core/PlateManager.cs +++ b/OpenNest.Core/PlateManager.cs @@ -199,6 +199,12 @@ namespace OpenNest private void OnPlateAdded(object sender, ItemAddedEventArgs e) { PlateListChanged?.Invoke(this, EventArgs.Empty); + + if (!suppressNavigation) + { + CurrentIndex = Count - 1; + FireCurrentPlateChanged(); + } } private void OnPlateRemoved(object sender, ItemRemovedEventArgs e) diff --git a/OpenNest.Tests/PlateManagerTests.cs b/OpenNest.Tests/PlateManagerTests.cs index 4e7a494..9810528 100644 --- a/OpenNest.Tests/PlateManagerTests.cs +++ b/OpenNest.Tests/PlateManagerTests.cs @@ -390,6 +390,8 @@ public class PlateManagerTests Assert.False(mgr.CanRemoveCurrent); nest.CreatePlate(); + // Auto-navigated to plate2 (empty), go back to plate1 (has parts) + mgr.LoadFirst(); Assert.True(mgr.CanRemoveCurrent); } }