Avoid division by zero in get_narrowed_* functions
* src/xdisp.c (get_narrowed_width, get_narrowed_len): Return at least 1 as the value. (Bug#61704)
This commit is contained in:
parent
fb5dbf6de7
commit
ba91a76659
1 changed files with 5 additions and 5 deletions
10
src/xdisp.c
10
src/xdisp.c
|
@ -3498,18 +3498,18 @@ init_iterator (struct it *it, struct window *w,
|
||||||
static int
|
static int
|
||||||
get_narrowed_width (struct window *w)
|
get_narrowed_width (struct window *w)
|
||||||
{
|
{
|
||||||
int fact;
|
|
||||||
/* In a character-only terminal, only one font size is used, so we
|
/* In a character-only terminal, only one font size is used, so we
|
||||||
can use a smaller factor. */
|
can use a smaller factor. */
|
||||||
fact = EQ (Fterminal_live_p (Qnil), Qt) ? 2 : 3;
|
int fact = EQ (Fterminal_live_p (Qnil), Qt) ? 2 : 3;
|
||||||
return fact * window_body_width (w, WINDOW_BODY_IN_CANONICAL_CHARS);
|
int width = window_body_width (w, WINDOW_BODY_IN_CANONICAL_CHARS);
|
||||||
|
return fact * max (1, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
get_narrowed_len (struct window *w)
|
get_narrowed_len (struct window *w)
|
||||||
{
|
{
|
||||||
return get_narrowed_width (w) *
|
int height = window_body_height (w, WINDOW_BODY_IN_CANONICAL_CHARS);
|
||||||
window_body_height (w, WINDOW_BODY_IN_CANONICAL_CHARS);
|
return get_narrowed_width (w) * max (1, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
ptrdiff_t
|
ptrdiff_t
|
||||||
|
|
Loading…
Add table
Reference in a new issue