emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 1fc73de: Improve how 'balance-windows' handles fixe


From: Martin Rudalics
Subject: [Emacs-diffs] master 1fc73de: Improve how 'balance-windows' handles fixed-size windows (Bug#33254)
Date: Sat, 8 Dec 2018 03:02:20 -0500 (EST)

branch: master
commit 1fc73de597ba395b3575c70dae68b6c3e5b5a3b7
Author: Martin Rudalics <address@hidden>
Commit: Martin Rudalics <address@hidden>

    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.
---
 lisp/window.el | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/lisp/window.el b/lisp/window.el
index 2634955..a16ceb4 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]