summaryrefslogtreecommitdiff
path: root/lisp/window.el
diff options
context:
space:
mode:
authorMartin Rudalics <rudalics@gmx.at>2018-12-08 09:01:23 +0100
committerMartin Rudalics <rudalics@gmx.at>2018-12-08 09:01:23 +0100
commit1fc73de597ba395b3575c70dae68b6c3e5b5a3b7 (patch)
treed57fe47c768da681800b8cc30ea5a67949a17c45 /lisp/window.el
parentf6a69957d654f0d0d870209da303b4e9360d577e (diff)
downloademacs-1fc73de597ba395b3575c70dae68b6c3e5b5a3b7.tar.gz
Improve how 'balance-windows' handles fixed-size windows (Bug#33254)
* lisp/window.el (balance-windows-2): When a child window has fixed size, don't count it as resizable (Bug#33254). Handle case where a window has no resizable child windows.
Diffstat (limited to 'lisp/window.el')
-rw-r--r--lisp/window.el31
1 files changed, 16 insertions, 15 deletions
diff --git a/lisp/window.el b/lisp/window.el
index 2634955a755..a16ceb4eb99 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5317,11 +5317,12 @@ is non-nil)."
(total-sum parent-size)
failed size sub-total sub-delta sub-amount rest)
(while sub
- (setq number-of-children (1+ number-of-children))
- (when (window-size-fixed-p sub horizontal)
- (setq total-sum
- (- total-sum (window-size sub horizontal t)))
- (set-window-new-normal sub 'ignore))
+ (if (window-size-fixed-p sub horizontal)
+ (progn
+ (setq total-sum
+ (- total-sum (window-size sub horizontal t)))
+ (set-window-new-normal sub 'ignore))
+ (setq number-of-children (1+ number-of-children)))
(setq sub (window-right sub)))
(setq failed t)
@@ -5346,16 +5347,16 @@ is non-nil)."
(set-window-new-normal sub 'skip)))
(setq sub (window-right sub))))
- ;; How can we be sure that `number-of-children' is NOT zero here ?
- (setq rest (% total-sum number-of-children))
- ;; Fix rounding by trying to enlarge non-stuck windows by one line
- ;; (column) until `rest' is zero.
- (setq sub first)
- (while (and sub (> rest 0))
- (unless (window--resize-child-windows-skip-p window)
- (set-window-new-pixel sub (min rest char-size) t)
- (setq rest (- rest char-size)))
- (setq sub (window-right sub)))
+ (when (> number-of-children 0)
+ (setq rest (% total-sum number-of-children))
+ ;; Fix rounding by trying to enlarge non-stuck windows by one line
+ ;; (column) until `rest' is zero.
+ (setq sub first)
+ (while (and sub (> rest 0))
+ (unless (window--resize-child-windows-skip-p window)
+ (set-window-new-pixel sub (min rest char-size) t)
+ (setq rest (- rest char-size)))
+ (setq sub (window-right sub))))
;; Fix rounding by trying to enlarge stuck windows by one line
;; (column) until `rest' equals zero.