From: Max Kellermann Date: Fri, 9 Oct 2009 18:48:19 +0000 (+0200) Subject: list_window: simplified the selection painting code X-Git-Tag: release-0.16~158 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=292d5700aef700807df64dbe1382050526767b3c;p=ncmpc.git list_window: simplified the selection painting code Combine all the checks in the two boolean variables "show_cursor" and "selected". --- diff --git a/src/list_window.c b/src/list_window.c index 92eaba5..86da180 100644 --- a/src/list_window.c +++ b/src/list_window.c @@ -328,6 +328,9 @@ list_window_paint(struct list_window *lw, } } + show_cursor = show_cursor && + (!options.hardware_cursor || lw->range_selection); + for (i = 0; i < lw->rows; i++) { const char *label; char *second_column = NULL; @@ -337,7 +340,9 @@ list_window_paint(struct list_window *lw, wmove(lw->w, i, 0); if (label) { - bool selected = (lw->start + i >= lw->selected_start && lw->start + i <= lw->selected_end); + bool selected = show_cursor && + lw->start + i >= lw->selected_start && + lw->start + i <= lw->selected_end; unsigned len = utf8_width(label); if (highlight) @@ -345,8 +350,7 @@ list_window_paint(struct list_window *lw, else colors_use(lw->w, COLOR_LIST); - if (show_cursor && selected && - (!options.hardware_cursor || lw->range_selection)) + if (selected) wattron(lw->w, A_REVERSE); //waddnstr(lw->w, label, lw->cols);