diff options
| author | Martin Rudalics | 2014-02-07 11:03:10 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2014-02-07 11:03:10 +0100 |
| commit | dc0e4c48518b5154cfcec60b710da50883a671dc (patch) | |
| tree | 35f04feb9c55f46061564985224ee33a9c45ad26 | |
| parent | 99f10a5dae1270696e9d65f0089985e8c89c28ab (diff) | |
| download | emacs-dc0e4c48518b5154cfcec60b710da50883a671dc.tar.gz emacs-dc0e4c48518b5154cfcec60b710da50883a671dc.zip | |
Constrain window body sizes.
* window.c (window_body_height, window_body_width): Don't return
negative value.
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/window.c | 12 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 07a6aaaf871..99d545cf99b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,9 +1,11 @@ | |||
| 1 | 2014-02-07 Martin Rudalics <rudalics@gmx.at> | 1 | 2014-02-07 Martin Rudalics <rudalics@gmx.at> |
| 2 | 2 | ||
| 3 | Constrain window box sizes (Bug#16649). | 3 | Constrain window box and body sizes (Bug#16649). |
| 4 | * xdisp.c (window_box_width): Don't return less than zero. | 4 | * xdisp.c (window_box_width): Don't return less than zero. |
| 5 | (window_box_left_offset, window_box_right_offset): Don't return | 5 | (window_box_left_offset, window_box_right_offset): Don't return |
| 6 | more than the window's pixel width. | 6 | more than the window's pixel width. |
| 7 | * window.c (window_body_height, window_body_width): Don't return | ||
| 8 | negative value. | ||
| 7 | 9 | ||
| 8 | 2014-02-07 Glenn Morris <rgm@gnu.org> | 10 | 2014-02-07 Glenn Morris <rgm@gnu.org> |
| 9 | 11 | ||
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) | |||
| 866 | - WINDOW_MODE_LINE_HEIGHT (w) | 866 | - WINDOW_MODE_LINE_HEIGHT (w) |
| 867 | - WINDOW_BOTTOM_DIVIDER_WIDTH (w)); | 867 | - WINDOW_BOTTOM_DIVIDER_WIDTH (w)); |
| 868 | 868 | ||
| 869 | return pixelwise ? height : height / FRAME_LINE_HEIGHT (WINDOW_XFRAME (w)); | 869 | /* Don't return a negative value. */ |
| 870 | return max (pixelwise | ||
| 871 | ? height | ||
| 872 | : height / FRAME_LINE_HEIGHT (WINDOW_XFRAME (w)), | ||
| 873 | 0); | ||
| 870 | } | 874 | } |
| 871 | 875 | ||
| 872 | /* Return the number of columns/pixels of W's body. Don't count columns | 876 | /* 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) | |||
| 893 | ? WINDOW_FRINGES_WIDTH (w) | 897 | ? WINDOW_FRINGES_WIDTH (w) |
| 894 | : 0)); | 898 | : 0)); |
| 895 | 899 | ||
| 896 | return pixelwise ? width : width / FRAME_COLUMN_WIDTH (WINDOW_XFRAME (w)); | 900 | /* Don't return a negative value. */ |
| 901 | return max (pixelwise | ||
| 902 | ? width | ||
| 903 | : width / FRAME_COLUMN_WIDTH (WINDOW_XFRAME (w)), | ||
| 904 | 0); | ||
| 897 | } | 905 | } |
| 898 | 906 | ||
| 899 | DEFUN ("window-body-height", Fwindow_body_height, Swindow_body_height, 0, 2, 0, | 907 | DEFUN ("window-body-height", Fwindow_body_height, Swindow_body_height, 0, 2, 0, |