From 2b384f69b45d00a9310d276fad2dfbfc0aabcc67 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Mon, 3 Jul 2017 22:05:38 -0400 Subject: [PATCH] Fix clearing of the status window Leaving a prompt with Ctrl-C was leaving artifacts such as ":^" on the screen. Fix report_clear to pass an empty string and use that to detect whether to call wclear. Possible fix for #623. --- include/tig/display.h | 2 +- src/display.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/tig/display.h b/include/tig/display.h index 923113c13..c680a72ae 100644 --- a/include/tig/display.h +++ b/include/tig/display.h @@ -24,7 +24,7 @@ extern WINDOW *status_win; void update_status(const char *msg, ...); void report(const char *msg, ...) PRINTF_LIKE(1, 2); -#define report_clear() report("%s", "") +#define report_clear() report("") /* * Display management. diff --git a/src/display.c b/src/display.c index f2e42f4e3..4e625bbb0 100644 --- a/src/display.c +++ b/src/display.c @@ -373,13 +373,17 @@ update_status_window(struct view *view, const char *msg, va_list args) return false; if (!status_empty || *msg) { + bool clear = view && view->has_scrolled && use_scroll_status_wclear; + wmove(status_win, 0, 0); - if (view && view->has_scrolled && use_scroll_status_wclear) + if (clear) wclear(status_win); if (*msg) { vwprintw(status_win, msg, args); status_empty = false; } else { + if (!clear && !status_empty) + wclear(status_win); status_empty = true; } wclrtoeol(status_win);