]> git.eshelyaron.com Git - emacs.git/commitdiff
Constrain window body sizes.
authorMartin Rudalics <rudalics@gmx.at>
Fri, 7 Feb 2014 10:03:10 +0000 (11:03 +0100)
committerMartin Rudalics <rudalics@gmx.at>
Fri, 7 Feb 2014 10:03:10 +0000 (11:03 +0100)
* window.c (window_body_height, window_body_width): Don't return
negative value.

src/ChangeLog
src/window.c

index 07a6aaaf871352878ac59012e5799d12431e9310..99d545cf99bd8c4543822ee1259dd79b6e3469f8 100644 (file)
@@ -1,9 +1,11 @@
 2014-02-07  Martin Rudalics  <rudalics@gmx.at>
 
-       Constrain window box sizes (Bug#16649).
+       Constrain window box and body sizes (Bug#16649).
        * xdisp.c (window_box_width): Don't return less than zero.
        (window_box_left_offset, window_box_right_offset): Don't return
        more than the window's pixel width.
+       * window.c (window_body_height, window_body_width): Don't return
+       negative value.
 
 2014-02-07  Glenn Morris  <rgm@gnu.org>
 
index 60ec913ebbfa2bc7159fb46e0971baa92c5754c8..adde3919699b1d3f7370f3ca45eec4731cb30e02 100644 (file)
@@ -866,7 +866,11 @@ window_body_height (struct window *w, bool pixelwise)
                - WINDOW_MODE_LINE_HEIGHT (w)
                - WINDOW_BOTTOM_DIVIDER_WIDTH (w));
 
-  return pixelwise ? height : height / FRAME_LINE_HEIGHT (WINDOW_XFRAME (w));
+  /* Don't return a negative value.  */
+  return max (pixelwise
+             ? height
+             : height / FRAME_LINE_HEIGHT (WINDOW_XFRAME (w)),
+             0);
 }
 
 /* Return the number of columns/pixels of W's body.  Don't count columns
@@ -893,7 +897,11 @@ window_body_width (struct window *w, bool pixelwise)
                   ? WINDOW_FRINGES_WIDTH (w)
                   : 0));
 
-  return pixelwise ? width : width / FRAME_COLUMN_WIDTH (WINDOW_XFRAME (w));
+  /* Don't return a negative value.  */
+  return max (pixelwise
+             ? width
+             : width / FRAME_COLUMN_WIDTH (WINDOW_XFRAME (w)),
+             0);
 }
 
 DEFUN ("window-body-height", Fwindow_body_height, Swindow_body_height, 0, 2, 0,