From de99e1068e3158866c0a537c27f035ae3d350d1a Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Fri, 16 Nov 2012 15:35:48 +0100 Subject: NCURSES interface: fix message displaying in batch mode (avoid any refresh) --- interface-ncurses.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/interface-ncurses.cpp b/interface-ncurses.cpp index da54c9c..f57af4e 100644 --- a/interface-ncurses.cpp +++ b/interface-ncurses.cpp @@ -127,6 +127,9 @@ InterfaceNCurses::vmsg(MessageType type, const gchar *fmt, va_list ap) void InterfaceNCurses::draw_info(void) { + if (isendwin()) /* batch mode */ + return; + wmove(info_window, 0, 0); wbkgdset(info_window, ' ' | SCI_COLOR_ATTR(COLOR_BLACK, COLOR_WHITE)); waddstr(info_window, info_current); @@ -186,7 +189,12 @@ void InterfaceNCurses::popup_add_filename(PopupFileType type, const gchar *filename, bool highlight) { - gchar *entry = g_strconcat(highlight ? "*" : " ", filename, NULL); + gchar *entry; + + if (isendwin()) /* batch mode */ + return; + + entry = g_strconcat(highlight ? "*" : " ", filename, NULL); popup.longest = MAX(popup.longest, (gint)strlen(filename)); popup.length++; @@ -201,6 +209,9 @@ InterfaceNCurses::popup_show(void) int popup_lines; gint popup_cols, cur_file; + if (isendwin()) /* batch mode */ + goto cleanup; + getmaxyx(stdscr, lines, cols); popup.longest += 3; @@ -231,6 +242,7 @@ InterfaceNCurses::popup_show(void) } wclrtoeol(popup.window); +cleanup: g_slist_free(popup.list); popup.list = NULL; popup.longest = popup.length = 0; -- cgit v1.2.3