From e9a7d2fddeda02ec947fb5b46e07174b6b48bbf9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 10 Oct 2009 20:20:24 +0200 Subject: [PATCH] list_window: simplified narrow cursor drawing Clear the space after the text before drawing the second column. The continue drawing the second column. --- src/list_window.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/list_window.c b/src/list_window.c index 124b482..0150fd6 100644 --- a/src/list_window.c +++ b/src/list_window.c @@ -351,8 +351,14 @@ list_window_paint_row(WINDOW *w, unsigned y, unsigned width, wattron(w, A_REVERSE); waddstr(w, text); - if (options.wide_cursor && text_width < width) - whline(w, ' ', width - text_width); + + /* erase the unused space after the text */ + if (text_width < width) { + if (options.wide_cursor) + whline(w, ' ', width - text_width); + else + wclrtoeol(w); + } if (second_column_width > 0) { wmove(w, y, width); @@ -362,17 +368,6 @@ list_window_paint_row(WINDOW *w, unsigned y, unsigned width, if (selected) wattroff(w, A_REVERSE); - - if (!options.wide_cursor && text_width < width) { - if (second_column_width == 0) - /* the cursor is at the end of the text; clear - the rest of this row */ - wclrtoeol(w); - else - /* there's a second column: clear the space - between the first and the second column */ - mvwhline(w, y, text_width, ' ', width - text_width); - } } void -- 2.30.2