emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/window.c


From: Jan Djärv
Subject: [Emacs-diffs] Changes to emacs/src/window.c
Date: Sun, 14 Nov 2004 07:05:03 -0500

Index: emacs/src/window.c
diff -c emacs/src/window.c:1.484 emacs/src/window.c:1.485
*** emacs/src/window.c:1.484    Fri Nov 12 14:26:53 2004
--- emacs/src/window.c  Sun Nov 14 11:59:21 2004
***************
*** 2657,2662 ****
--- 2657,2665 ----
              --shrinkable;
              total_removed += smallest;
  
+             /* We don't know what the smallest is now.  */
+             smallest = total;
+ 
              /* Out of for, just remove one window at the time and
                 check again if we have enough space.  */
              break;
***************
*** 2681,2686 ****
--- 2684,2699 ----
       that are left and still can be shrunk.  */
    while (total_shrink > total_removed)
      {
+       int nonzero_sizes = 0;
+       int nonzero_idx = -1;
+ 
+       for (i = 0; i < nchildren; ++i)
+         if (new_sizes[i] > 0)
+           {
+             ++nonzero_sizes;
+             nonzero_idx = i;
+           }
+       
        for (i = 0; i < nchildren; ++i)
          if (new_sizes[i] > min_size)
            {
***************
*** 2691,2696 ****
--- 2704,2728 ----
                 check again if we have enough space.  */
              break;
            }
+ 
+ 
+       /* Special case, only one window left.  */
+       if (nonzero_sizes == 1)
+         break;
+     }
+ 
+   /* Any surplus due to rounding, we add to windows that are left.  */
+   while (total_shrink < total_removed)
+     {
+       for (i = 0; i < nchildren; ++i)
+         {
+           if (new_sizes[i] != 0 && total_shrink < total_removed)
+             {
+               ++new_sizes[i];
+               --total_removed;
+               break;
+             }
+         }
      }
  
    return new_sizes;




reply via email to

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