Fix recombination of side windows (Bug#80665)

* lisp/window.el (window--make-major-side-window): Protect the
sibling (the main-window group) from recombination.  Without
this, deleting a side window can flatten the group into the
root, causing subsequent side windows on other sides to be
placed incorrectly (Bug#80665).

Copyright-paperwork-exempt: yes
This commit is contained in:
Emil Ingelman Sahlén
2026-03-27 19:48:02 +01:00
committed by Martin Rudalics
parent 3b7d9e37ce
commit 57b119b296

View File

@@ -1010,6 +1010,14 @@ and may be called only if no window on SIDE exists yet."
(cons `(dedicated . ,(or display-buffer-mark-dedicated 'side))
alist))))
(when window
;; Protect the sibling (the main-window group) from recombination.
;; Without this, deleting a side window can flatten the group into
;; the root, causing subsequent side windows on other sides to be
;; placed incorrectly (Bug#80665).
(when-let* ((sibling (or (window-prev-sibling window)
(window-next-sibling window)))
(window-child sibling))
(set-window-combination-limit sibling t))
;; Initialize `window-side' parameter of new window to SIDE and
;; make that parameter persistent.
(set-window-parameter window 'window-side side)