From fede8da14b5f65a301ce3459a93a95aeffce67d7 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 7 Sep 2015 23:52:34 +0100 Subject: [PATCH] Delete all existig window before resizing --- src/ncurses_ui.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index 5d2001eb..0b221e34 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -437,10 +437,20 @@ void NCursesUI::check_resize(bool force) winsize ws; if (ioctl(fd, TIOCGWINSZ, (void*)&ws) == 0) { + auto delete_win = [](NCursesWin*& win) { + if (win) + { + delwin(win); + win = nullptr; + } + }; + + delete_win(m_window); + delete_win(m_info_win); + delete_win(m_menu_win); + resize_term(ws.ws_row, ws.ws_col); - if (m_window) - delwin(m_window); m_window = (NCursesWin*)newwin(ws.ws_row, ws.ws_col, 0, 0); m_dimensions = CharCoord{ws.ws_row-1, ws.ws_col};