]> git.deb.at Git - pkg/abook.git/commitdiff
Fixed "out-of-screen" display.
authorCedric Duval <cedricduval@free.fr>
Thu, 7 Sep 2006 23:17:53 +0000 (23:17 +0000)
committerCedric Duval <cedricduval@free.fr>
Thu, 7 Sep 2006 23:17:53 +0000 (23:17 +0000)
list.c

diff --git a/list.c b/list.c
index 55046927e30303aa42a85268064662079da1bd90..7a04397e493a536b21588692917d459c6de9479d 100644 (file)
--- 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