https://bugs.kde.org/show_bug.cgi?id=495419
Christoph Cullmann <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Latest Commit|https://invent.kde.org/util |https://invent.kde.org/util |ities/kate/-/commit/c162bfc |ities/kate/-/commit/ece2a91 |323230932ebfe85a280e7b8c5a7 |479bae77eaec8661f268501ad3b |db8b2c |e52157 --- Comment #19 from Christoph Cullmann <[email protected]> --- Git commit ece2a91479bae77eaec8661f268501ad3be52157 by Christoph Cullmann. Committed on 14/07/2025 at 20:20. Pushed by cullmann into branch 'release/25.08'. Fix tab order restore with limited tabs If the number of documents are greater than the user set "Tab Limit", then tab order restore was broken. The existing implementation did the simple thing: ``` // assume tab limit = 2 docList = [1, 2, 3] // expected restore order = [2, 3] register doc "1", // gets tab 0 register doc "2", // gets tab 1 register doc "3", // gets tab 0, replace 0 because its the lru doc restored order = [3, 2] // incorrect ``` To fix this, we must do an additional pass over the tabs and restore the tabs to what the docList says. We can do this simply by calling setTabDocument for each document we have in the right order. To find the right order, instead of traversing the docList again we can just use m_registeredDocuments which stores the document in MRU order. So for the above case, the order is: ``` m_registeredDocument = [3, 2, 1] ``` We can just reverse iterate m_registeredDocuments and fix the tabs. But we can't just iterate it directly, we must first skip the documents that don't have tabs. We can find that by simply subtracting the number of tabs from m_registeredDocuments. This works because when saving session state we always put the documents that don't have tabs first and then we add the documents that have tabs. Also add a test case for this so that it doesn't break again. Signed-off-by: Waqar Ahmed <[email protected]> (cherry picked from commit 988e8514c3ba6b7b4325b97e1d08e25d28700cf4) Co-authored-by: Waqar Ahmed <[email protected]> M +76 -0 apps/lib/autotests/kate_view_mgmt_test2.cpp M +17 -0 apps/lib/kateviewspace.cpp M +1 -0 apps/lib/kateviewspace.h https://invent.kde.org/utilities/kate/-/commit/ece2a91479bae77eaec8661f268501ad3be52157 -- You are receiving this mail because: You are watching all bug changes.
