From f3a441043dd396c280b759e40d0dacab78fb1984 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 25 Jun 2019 08:28:10 +0200 Subject: [PATCH] display: where needed, use slow blanking, but elsewhere do it much faster Where the row needs to be filled with spaces with the attributes that were set (title bar, prompt bar, and browser highlight), use printw(). But when the row needs to be actually cleared, use the much faster clrtoeol(). This reduces the time needed to clear a full row with 95 percent. --- src/browser.c | 2 +- src/prompt.c | 4 ++-- src/winio.c | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/browser.c b/src/browser.c index efd53635..2c254fa2 100644 --- a/src/browser.c +++ b/src/browser.c @@ -532,7 +532,7 @@ void browser_refresh(void) the_column = col; } - blank_row(edit, row, col, longest); + mvwprintw(edit, row, col, "%*s", longest, " "); /* If the name is too long, we display something like "...ename". */ if (dots) diff --git a/src/prompt.c b/src/prompt.c index 27a428fd..b7862f06 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -394,7 +394,7 @@ void draw_the_promptbar(void) /* Color the promptbar over its full width. */ wattron(bottomwin, interface_color_pair[TITLE_BAR]); - blank_statusbar(); + mvwprintw(bottomwin, 0, 0, "%*s", COLS, " "); mvwaddstr(bottomwin, 0, 0, prompt); waddch(bottomwin, ':'); @@ -697,7 +697,7 @@ int do_yesno_prompt(bool all, const char *msg) /* Color the statusbar over its full width and display the question. */ wattron(bottomwin, interface_color_pair[TITLE_BAR]); - blank_statusbar(); + mvwprintw(bottomwin, 0, 0, "%*s", COLS, " "); mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1)); wattroff(bottomwin, interface_color_pair[TITLE_BAR]); wnoutrefresh(bottomwin); diff --git a/src/winio.c b/src/winio.c index 2f568af7..3a822a85 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1794,13 +1794,14 @@ const keystruct *get_shortcut(int *kbinput) * current attributes. */ void blank_row(WINDOW *win, int y, int x, int n) { - mvwprintw(win, y, x, "%*s", n, " "); + wmove(win, y, 0); + wclrtoeol(win); } /* Blank the first line of the top portion of the window. */ void blank_titlebar(void) { - blank_row(topwin, 0, 0, COLS); + mvwprintw(topwin, 0, 0, "%*s", COLS, " "); } /* Blank all the lines of the middle portion of the window, i.e. the