From 168a9ad796933456cb75ea156402eec77046c5ab Mon Sep 17 00:00:00 2001 From: Cedric Duval Date: Thu, 7 Sep 2006 23:17:53 +0000 Subject: [PATCH] Fixed "out-of-screen" display. --- list.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 -- 2.39.2