diff --git a/lisp/window.el b/lisp/window.el index 16f16a75418..145558bb773 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -6169,7 +6169,14 @@ window--state-put-1 (let* ((horizontal (eq type 'hc)) (total (window-size window horizontal pixelwise)) (first t) - (window-combination-limit (cdr (assq 'combination-limit state))) + ;; Make sure to make a new parent window for a horizontal + ;; or vertical combination embedded in one of the same type + ;; (see Bug#50867 and Bug#64405). + (window-combination-limit + (and (or (eq (cdr (assq 'combination-limit state)) t) + (and horizontal (window-combined-p window t)) + (and (not horizontal) (window-combined-p window))) + t)) size new) (dolist (item state) ;; Find the next child window. WINDOW always points to the @@ -6409,7 +6416,10 @@ window-state-put head))) (min-width (cdr (assq (if pixelwise 'min-pixel-width 'min-weight) - head)))) + head))) + ;; Bind the following two variables. `window--state-put-1' has + ;; to fully control them (see Bug#50867 and Bug#64405). + window-combination-limit window-combination-resize) (if (and (not totals) (or (> min-height (window-size window nil pixelwise)) (> min-width (window-size window t pixelwise)))