From 292d5700aef700807df64dbe1382050526767b3c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 9 Oct 2009 20:48:19 +0200 Subject: [PATCH] list_window: simplified the selection painting code Combine all the checks in the two boolean variables "show_cursor" and "selected". --- src/list_window.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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); -- 2.30.2