SUMMARY If there are split views, and I close a tab in the split view *other than* the one that currently has keyboard focus, it (sometimes) switches tabs also on the side that has had keyboard focus: namely it switches to the file on the focused side that becomes active on the other side (which may be a newly activated tab if the active tab was closed, or the tab that was already active in the other split view if an inactive tab was closed). This may even involve opening a file on the focused side that hasn't previously been open there. Also, keyboard focus usually moves to the right-hand split view (in the case of a vertical split). The issue as described above doesn't always happen; I'm not sure about the exact conditions, but at least it's not reliably reproducible if some of the tabs involved come from a saved session, and haven't been active since Kate was opened. STEPS TO REPRODUCE 1. Start Kate with an empty session. 2. Open File A. 3. Click Split Vertical. Now file A is open on both sides, and the right side is focused. 4. Open File C. 5. Click in the editor on the left side to focus it. 6. Open File B. Now A and B are opened on the left, A and C on the right, with B and C respectively being the active tabs, and B having keyboard focus. 7. Close C by clicking on the X button in the tab. (Alternative: 7'. Click in the editor on the right to focus it, then close B by clicking on the X button in the tab.) OBSERVED RESULT On the left side, Tab A becomes active (while B remains open). On the right side, C is closed, A becomes active, and obtains keyboard focus. (In the alternative version: On the right side, Tab A becomes active, while C remains open. On the left side, B is closed, A becomes active. Keyboard focus goes to A on the right side.) EXPECTED RESULT The left split view remains unchanged. On the right side, C is closed, and A becomes active. (In the alternative version: The right split view remains unchanged. On the left side, B is closed, and A becomes active.) Also, keyboard focus should be handled consistently: it should either always remain in the view that previously had it (probably the more reasonable option), or always switch to the view in which a tab was closed. SOFTWARE/OS VERSIONS Operating System: openSUSE Tumbleweed 20230214 KDE Plasma Version: 5.27.0 KDE Frameworks Version: 5.103.0 Qt Version: 5.15.8 Graphics Platform: tried both X11 and Wayland; it doesn't matter ADDITIONAL INFORMATION May be related to Bug 465807; that one is about closing a tab in the view with keyboard focus, this one about closing a tab in the other view. In particular, the keyboard focus always ending up on the right is probably the same issue. The ancient Bug 77525 also seems similar.
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/1110
Git commit f417673ddf0f396fb79e8ce9524784aea9846085 by Waqar Ahmed. Committed on 17/02/2023 at 10:29. Pushed by cullmann into branch 'master'. Fix closing tab in other split changes tabs in current split FIXED-IN: 23.04 M +54 -0 apps/lib/autotests/kate_view_mgmt_tests.cpp M +1 -0 apps/lib/autotests/kate_view_mgmt_tests.h M +9 -5 apps/lib/kateviewmanager.cpp https://invent.kde.org/utilities/kate/commit/f417673ddf0f396fb79e8ce9524784aea9846085
Git commit 40fc1f15350e778febd67551ba26febed6256177 by Waqar Ahmed. Committed on 28/02/2023 at 12:59. Pushed by waqar into branch 'release/22.12'. Fix closing tab in other split changes tabs in current split FIXED-IN: 23.04 (cherry picked from commit f417673ddf0f396fb79e8ce9524784aea9846085) M +54 -0 apps/lib/autotests/kate_view_mgmt_tests.cpp M +1 -0 apps/lib/autotests/kate_view_mgmt_tests.h M +9 -5 apps/lib/kateviewmanager.cpp https://invent.kde.org/utilities/kate/commit/40fc1f15350e778febd67551ba26febed6256177