From c58ae6f9e18debfd04b44ac1a4bb2123026bda67 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Thu, 22 Oct 2026 08:28:37 -0400 Subject: [PATCH] fix(desktop): keep the plate list selection in sync with the header arrows Navigating plates from the plate view header (or Ctrl+Left/Right) changed the plate without updating the plate list, so its highlighted row pointed at a different plate. Select, focus and scroll to the current plate's row whenever the current plate changes, guarded so the list doesn't reload it. Co-Authored-By: Claude Opus 5.5 --- OpenNest/Forms/EditNestForm.cs | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/OpenNest/Forms/EditNestForm.cs b/OpenNest/Forms/EditNestForm.cs index 63c54d41..3f738ab9 100644 --- a/OpenNest/Forms/EditNestForm.cs +++ b/OpenNest/Forms/EditNestForm.cs @@ -1025,13 +1025,32 @@ namespace OpenNest.Forms private void FirePlateChanged(bool updateListView = true) { - if (updateListView && PlateManager.CurrentIndex < platesListView.Items.Count) - platesListView.Items[PlateManager.CurrentIndex].Selected = true; + if (updateListView) + SelectCurrentPlateInList(); UpdatePlateHeader(); PlateChanged?.Invoke(this, EventArgs.Empty); } + private void SelectCurrentPlateInList() + { + var index = PlateManager.CurrentIndex; + if (index < 0 || index >= platesListView.Items.Count) + return; + + var item = platesListView.Items[index]; + if (item.Selected) + return; + + // Guarded so the list's own SelectedIndexChanged doesn't reload the plate. + var wasUpdating = updatingPlateList; + updatingPlateList = true; + item.Selected = true; + item.Focused = true; + item.EnsureVisible(); + updatingPlateList = wasUpdating; + } + private void UpdatePlateHeader() { var plate = PlateManager.CurrentPlate; @@ -1445,6 +1464,7 @@ namespace OpenNest.Forms { PlateView.Plate = PlateManager.CurrentPlate; PlateView.ZoomToFit(); + SelectCurrentPlateInList(); UpdatePlateHeader(); UpdateRemovePlateButton(); PlateChanged?.Invoke(this, EventArgs.Empty);