From c787128a7c49555c8d1d49bd246dc9df92a5370b Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 16 Sep 2019 21:57:53 +1000 Subject: [PATCH] Restore palette before suspend --- src/ncurses_ui.cc | 9 ++++----- src/ncurses_ui.hh | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index c0f2a5c6..81688a86 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -382,11 +382,7 @@ NCursesUI::NCursesUI() NCursesUI::~NCursesUI() { enable_mouse(false); - if (can_change_color()) // try to reset palette - { - fputs("\033]104\007", stdout); - fflush(stdout); - } + m_palette.set_change_colors(false); endwin(); tcsetattr(STDIN_FILENO, TCSAFLUSH, &m_original_termios); set_signal_handler(SIGWINCH, SIG_DFL); @@ -398,6 +394,8 @@ void NCursesUI::suspend() { bool mouse_enabled = m_mouse_enabled; enable_mouse(false); + bool change_color_enabled = m_palette.get_change_colors(); + m_palette.set_change_colors(false); endwin(); auto current = set_signal_handler(SIGTSTP, SIG_DFL); @@ -416,6 +414,7 @@ void NCursesUI::suspend() doupdate(); check_resize(true); set_raw_mode(); + m_palette.set_change_colors(change_color_enabled); enable_mouse(mouse_enabled); } diff --git a/src/ncurses_ui.hh b/src/ncurses_ui.hh index 141750a3..3a7b406a 100644 --- a/src/ncurses_ui.hh +++ b/src/ncurses_ui.hh @@ -87,6 +87,7 @@ private: public: int get_color_pair(const Face& face); + bool get_change_colors() const { return m_change_colors; } bool set_change_colors(bool change_colors); };