From: Martin Rudalics Date: Fri, 7 Feb 2014 10:03:10 +0000 (+0100) Subject: Constrain window body sizes. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~130 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=dc0e4c48518b5154cfcec60b710da50883a671dc;p=emacs.git Constrain window body sizes. * window.c (window_body_height, window_body_width): Don't return negative value. --- diff --git a/src/ChangeLog b/src/ChangeLog index 07a6aaaf871..99d545cf99b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,9 +1,11 @@ 2014-02-07 Martin Rudalics - 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 diff --git a/src/window.c b/src/window.c index 60ec913ebbf..adde3919699 100644 --- a/src/window.c +++ b/src/window.c @@ -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,