X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=list.c;h=7a04397e493a536b21588692917d459c6de9479d;hb=b281ff74163f08f1a665108b55ce25ee0cdca32a;hp=3051691c1cfeb7b3b764f143e139cd6512babe9e;hpb=3370ba68ac9cbbd583da6997c039b29b0fc43b7a;p=pkg%2Fabook.git diff --git a/list.c b/list.c index 3051691..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); @@ -191,6 +191,33 @@ print_list_field(int item, int line, int *x_pos, struct index_elem *e) *x_pos += len ? len : width; } +static void +highlight_line(WINDOW *win, int line) +{ + wstandout(win); + + /* + * this is a tricky one + */ +#if 0 +/*#ifdef mvwchgat*/ + mvwchgat(win, line, 0, -1, A_STANDOUT, 0, NULL); +#else + /* + * buggy function: FIXME + */ + scrollok(win, FALSE); + { + int i; + wmove(win, line, 0); + for(i = 0; i < COLS; i++) + waddch(win, ' '); + /*wattrset(win, 0);*/ + } + scrollok(win, TRUE); +#endif +} + static void print_list_line(int item, int line, int highlight) { @@ -279,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 @@ -422,33 +452,6 @@ goto_end() refresh_list(); } -void -highlight_line(WINDOW *win, int line) -{ - wstandout(win); - - /* - * this is a tricky one - */ -#if 0 -/*#ifdef mvwchgat*/ - mvwchgat(win, line, 0, -1, A_STANDOUT, 0, NULL); -#else - /* - * buggy function: FIXME - */ - scrollok(win, FALSE); - { - int i; - wmove(win, line, 0); - for(i = 0; i < COLS; i++) - waddch(win, ' '); - /*wattrset(win, 0);*/ - } - scrollok(win, TRUE); -#endif -} - int selected_items() {