From bf5af3b6dda0514aee3b1481c34f6e06ea6f6b91 Mon Sep 17 00:00:00 2001 From: BRUNER Patrick Date: Wed, 29 Jul 2026 20:38:02 +0200 Subject: [PATCH] fix: keep floating tabs in GetAllWindowsFromDockPanel PR #685 changed the method to enumerate DockPanel.Panes so the returned order matches the visible tab strips, but filtered the panes down to DockState.Document. LogWindows may also float (DockAreas.Document | DockAreas.Float is set in LogTabWindow.AddLogWindow), so any floated tab was dropped from the result. That silently lost floated tabs from LastOpenFilesList on exit, and from the FileNames list written to .lxj session files - where the layout XML still referenced the window, leaving the entry to vanish on restore. Enumerate panes of every dock state, and read DisplayingContents rather than Contents so the order is the one the tab strip renders. --- .../TabControllerService/TabController.cs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/LogExpert.UI/Services/TabControllerService/TabController.cs b/src/LogExpert.UI/Services/TabControllerService/TabController.cs index 2e4f1293..b91a1a24 100644 --- a/src/LogExpert.UI/Services/TabControllerService/TabController.cs +++ b/src/LogExpert.UI/Services/TabControllerService/TabController.cs @@ -455,19 +455,19 @@ protected virtual void Dispose (bool disposing) } /// - /// Gets all LogWindow instances from the DockPanel's Contents collection. + /// Gets all LogWindow instances currently held by the DockPanel's panes, in the order their tab strips display + /// them. Panes of every dock state are enumerated, so floating windows are included. /// /// Read-only list of all LogWindows in the DockPanel - public IReadOnlyList GetAllWindowsFromDockPanel () - { - return !_initialized || _dockPanel == null - ? [] - : _dockPanel.Panes - .Where(pane => pane.DockState == DockState.Document) - .SelectMany(pane => pane.Contents.OfType()) - .ToList() - .AsReadOnly(); - } + public IReadOnlyList GetAllWindowsFromDockPanel () + { + return !_initialized || _dockPanel == null + ? [] + : _dockPanel.Panes + .SelectMany(pane => pane.DisplayingContents.OfType()) + .ToList() + .AsReadOnly(); + } #endregion }