From: Cedric Duval Date: Thu, 7 Sep 2006 23:17:53 +0000 (+0000) Subject: Fixed "out-of-screen" display. X-Git-Tag: upstream/0.6.1~2^2~81 X-Git-Url: https://git.deb.at/?p=pkg%2Fabook.git;a=commitdiff_plain;h=168a9ad796933456cb75ea156402eec77046c5ab Fixed "out-of-screen" display. --- diff --git a/list.c b/list.c index 5504692..7a04397 100644 --- a/list.c +++ b/list.c @@ -180,7 +180,7 @@ print_list_field(int item, int line, int *x_pos, struct index_elem *e) width = len ? bytes2width(s, len) : strwidth(s); x_start = *x_pos + ((e->d.field.len < 0) ? len - width : 0); if(width + x_start >= COLS) - width = COLS - x_start; + width = bytes2width(s, COLS - x_start); if(width) mvwaddnstr(list, line, x_start, s, width); @@ -306,7 +306,10 @@ list_headerline() x_pos += strwidth(e->d.text); else if(e->type == INDEX_FIELD) { get_field_info(e->d.field.id, NULL, &str, NULL); - width = e->d.field.len ? abs(e->d.field.len) : strwidth(str); + width = e->d.field.len ? + abs(e->d.field.len) : strwidth(str); + if(width + x_pos > COLS) + width = bytes2width(str, COLS - x_pos); mvaddnstr(2, x_pos, str, width); x_pos += width; } else