1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Prevent internal errors when terminal width or height are very small

(1x1 was fatal).
This commit is contained in:
Laurent MONIN 2007-04-27 17:55:12 +02:00 committed by Laurent MONIN
parent a9bbaac3cd
commit 3ae299c3ca
2 changed files with 6 additions and 4 deletions

View File

@ -496,6 +496,8 @@ draw_text(struct terminal *term, int x, int y,
assert(text && length >= 0);
if_assert_failed return;
if (x >= term->width || y >= term->height) return;
#ifdef CONFIG_UTF8
if (term->utf8) {
draw_text_utf8(term, x, y, text, length, attr, color);

View File

@ -39,10 +39,10 @@ colspan_is_in_box(struct box *box, int x, int span)
static inline void
set_box(struct box *box, int x, int y, int width, int height)
{
box->x = x;
box->y = y;
box->width = width;
box->height = height;
box->x = int_max(0, x);
box->y = int_max(0, y);
box->width = int_max(0, width);
box->height = int_max(0, height);
}
static inline void