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,v


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/src/window.c,v
Date: Mon, 19 Jun 2006 21:59:31 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Richard M. Stallman <rms>       06/06/19 21:59:31

Index: window.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/window.c,v
retrieving revision 1.549
retrieving revision 1.550
diff -u -b -r1.549 -r1.550
--- window.c    13 Jun 2006 23:07:56 -0000      1.549
+++ window.c    19 Jun 2006 21:59:30 -0000      1.550
@@ -63,7 +63,7 @@
 static void window_scroll_line_based P_ ((Lisp_Object, int, int, int));
 static int window_min_size_1 P_ ((struct window *, int));
 static int window_min_size P_ ((struct window *, int, int, int *));
-static void size_window P_ ((Lisp_Object, int, int, int));
+static void size_window P_ ((Lisp_Object, int, int, int, int, int));
 static int freeze_window_start P_ ((struct window *, void *));
 static int window_fixed_size_p P_ ((struct window *, int, int));
 static void enlarge_window P_ ((Lisp_Object, int, int));
@@ -2826,17 +2826,23 @@
 
 /* Set WINDOW's height or width to SIZE.  WIDTH_P non-zero means set
    WINDOW's width.  Resize WINDOW's children, if any, so that they
-   keep their proportionate size relative to WINDOW.  Propagate
-   WINDOW's top or left edge position to children.  Delete windows
-   that become too small unless NODELETE_P is non-zero.
+   keep their proportionate size relative to WINDOW.
+
+   If FIRST_ONLY is 1, change only the first of WINDOW's children when
+   they are in series.  If LAST_ONLY is 1, change only the last of
+   WINDOW's children when they are in series.
+
+   Propagate WINDOW's top or left edge position to children.  Delete
+   windows that become too small unless NODELETE_P is non-zero.
 
    If NODELETE_P is 2, that means we do delete windows that are
    too small, even if they were too small before!  */
 
 static void
-size_window (window, size, width_p, nodelete_p)
+size_window (window, size, width_p, nodelete_p, first_only, last_only)
      Lisp_Object window;
      int size, width_p, nodelete_p;
+     int first_only, last_only;
 {
   struct window *w = XWINDOW (window);
   struct window *c;
@@ -2911,6 +2917,7 @@
 
   if (!NILP (*sideward))
     {
+      /* We have a chain of parallel siblings whose size should all change.  */
       for (child = *sideward; !NILP (child); child = c->next)
        {
          c = XWINDOW (child);
@@ -2918,8 +2925,44 @@
            c->left_col = w->left_col;
          else
            c->top_line = w->top_line;
-         size_window (child, size, width_p, nodelete_p);
+         size_window (child, size, width_p, nodelete_p,
+                      first_only, last_only);
+       }
+    }
+  else if (!NILP (*forward) && last_only)
+    {
+      /* Change the last in a series of siblings.  */
+      Lisp_Object last_child;
+      int child_size;
+
+      for (child = *forward; !NILP (child); child = c->next)
+       {
+         c = XWINDOW (child);
+         last_child = child;
+       }
+
+      child_size = XINT (width_p ? c->total_cols : c->total_lines);
+      size_window (last_child,
+                  size - old_size + child_size,
+                  width_p, nodelete_p, first_only, last_only);
        }
+  else if (!NILP (*forward) && first_only)
+    {
+      /* Change the first in a series of siblings.  */
+      int child_size;
+
+      child = *forward;
+      c = XWINDOW (child);
+
+      if (width_p)
+       c->left_col = w->left_col;
+      else
+       c->top_line = w->top_line;
+
+      child_size = XINT (width_p ? c->total_cols : c->total_lines);
+      size_window (child,
+                  size - old_size + child_size,
+                  width_p, nodelete_p, first_only, last_only);
     }
   else if (!NILP (*forward))
     {
@@ -2928,7 +2971,7 @@
       int last_pos, first_pos, nchildren, total;
       int *new_sizes = NULL;
 
-      /* Determine the fixed-size portion of the this window, and the
+      /* Determine the fixed-size portion of this window, and the
         number of child windows.  */
       fixed_size = nchildren = nfixed = total = 0;
       for (child = *forward; !NILP (child); child = c->next, ++nchildren)
@@ -2991,7 +3034,7 @@
          /* Set new height.  Note that size_window also propagates
             edge positions to children, so it's not a no-op if we
             didn't change the child's size.  */
-         size_window (child, new_size, width_p, 1);
+         size_window (child, new_size, width_p, 1, first_only, last_only);
 
          /* Remember the bottom/right edge position of this child; it
             will be used to set the top/left edge of the next child.  */
@@ -3010,7 +3053,7 @@
            int child_size;
            c = XWINDOW (child);
            child_size = width_p ? XINT (c->total_cols) : XINT (c->total_lines);
-           size_window (child, child_size, width_p, 2);
+           size_window (child, child_size, width_p, 2, first_only, last_only);
          }
     }
 }
@@ -3026,7 +3069,7 @@
      int height;
      int nodelete;
 {
-  size_window (window, height, 0, nodelete);
+  size_window (window, height, 0, nodelete, 0, 0);
 }
 
 
@@ -3041,7 +3084,7 @@
      int width;
      int nodelete;
 {
-  size_window (window, width, 1, nodelete);
+  size_window (window, width, 1, nodelete, 0, 0);
 }
 
 /* Change window heights in windows rooted in WINDOW by N lines.  */
@@ -4281,8 +4324,8 @@
 
       if (NILP (window))
        {
-         /* This can happen if WINDOW on the previous iteration was
-            at top level of the tree and we did not exit.  */
+         /* This happens if WINDOW on the previous iteration was
+            at top level of the window tree.  */
          Fset_window_configuration (old_config);
          error ("Specified window edge is fixed");
        }
@@ -4296,6 +4339,14 @@
        {
          if (! NILP (parent) && !NILP (XWINDOW (parent)->vchild))
            first_parallel = XWINDOW (parent)->vchild;
+         else if (NILP (parent) && !NILP (p->next))
+           {
+             /* Handle the vertical chain of main window and minibuffer
+                which has no parent.  */
+             first_parallel = window;
+             while (! NILP (XWINDOW (first_parallel)->prev))
+               first_parallel = XWINDOW (first_parallel)->prev;
+           }
        }
       else
        {
@@ -4304,8 +4355,10 @@
        }
 
       /* If this level's succession is in the desired dimension,
-        and this window is the last one, its trailing edge is fixed.  */
-      if (NILP (XWINDOW (window)->next) && NILP (first_parallel))
+        and this window is the last one, and there is no higher level,
+        its trailing edge is fixed.  */
+      if (NILP (XWINDOW (window)->next) && NILP (first_parallel)
+         && NILP (parent))
        {
          Fset_window_configuration (old_config);
          error ("Specified window edge is fixed");
@@ -4347,7 +4400,7 @@
              XSETINT (CURBEG (p->next),
                       XINT (CURBEG (p->next)) + delta);
              size_window (p->next, XINT (CURSIZE (p->next)) - delta,
-                          horiz_flag, 0);
+                          horiz_flag, 0, 1, 0);
              break;
            }
        }
@@ -4359,7 +4412,7 @@
             child = XWINDOW (child)->next)
          if (! EQ (child, window))
            size_window (child, XINT (CURSIZE (child)) + delta,
-                        horiz_flag, 0);
+                        horiz_flag, 0, 0, 1);
 
       window = parent;
     }




reply via email to

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