X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=gui.c;h=3c1889ca51ae44fa89fdea7999aad0dcd31dcb33;hb=d148baae9e045d55bf298740da59585e46f6b89a;hp=eba1e2a59331564a40677a123d1220dc9120c059;hpb=dd98d31d017bbbe16bf6711e0343b267dd6cfe89;p=paraslash.git diff --git a/gui.c b/gui.c index eba1e2a5..3c1889ca 100644 --- a/gui.c +++ b/gui.c @@ -33,10 +33,10 @@ static int signal_pipe; static struct win_data { WINDOW *win; - NCURSES_SIZE_T begx; - NCURSES_SIZE_T begy; - NCURSES_SIZE_T cols; - NCURSES_SIZE_T lines; + size_t begx; + size_t begy; + size_t cols; + size_t lines; } top, bot, sb, in, sep; #define RINGBUFFER_SIZE 512 @@ -400,11 +400,13 @@ static int draw_top_rbe(unsigned *lines) rbe = ringbuffer_get(bot_win_rb, fvr); if (!rbe) return -1; - /* first rbe might be only partially visible */ - offset = (*lines - bot.lines) * bot.cols; len = strlen(rbe->msg); - if (offset < 0 || len < offset) - return -1; + if (*lines > bot.lines) { + /* first rbe is only partially visible */ + offset = (*lines - bot.lines) * bot.cols; + assert(offset <= len); + } else + offset = 0; wattron(bot.win, COLOR_PAIR(rbe->color)); waddstr(bot.win, rbe->msg + offset); *lines = NUM_LINES(len - offset);