diff options
author | Eli Zaretskii <eliz@gnu.org> | 2016-01-15 17:36:47 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2016-01-15 17:36:47 +0200 |
commit | 740849fe986b62a839bce4bbf67d0036fc1be0b9 (patch) | |
tree | 04ae1b613906ff352e6ab12c4b113d23968f8ba5 /src | |
parent | aa636c8465b03c09249dccd68fca3d1df04eaa2c (diff) | |
download | emacs-740849fe986b62a839bce4bbf67d0036fc1be0b9.tar.gz |
Ensure positive number of glyphs for margins of positive width
* src/dispnew.c (margin_glyphs_to_reserve): Always return a
positive value when a non-zero width of the marginal area was
requested. (Bug#22356)
Diffstat (limited to 'src')
-rw-r--r-- | src/dispnew.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index 8d671f82e47..3e1557fa3b9 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -320,7 +320,9 @@ margin_glyphs_to_reserve (struct window *w, int total_glyphs, int margin) int width = w->total_cols; double d = max (0, margin); d = min (width / 2 - 1, d); - return (int) ((double) total_glyphs / width * d); + /* Since MARGIN is positive, we cannot possibly have less than + one glyph for the marginal area. */ + return max (1, (int) ((double) total_glyphs / width * d)); } return 0; } |