Emit an OSC 104 on quit to reset color palette on supporting terminals

xterm and vte based terminals support it, unfortunately rxvt-unicode
does not yet.

Fixes #914
This commit is contained in:
Maxime Coste 2016-11-05 11:43:25 +00:00
parent 8e5f491d3f
commit 6889494869

View File

@ -261,6 +261,11 @@ NCursesUI::NCursesUI()
NCursesUI::~NCursesUI() NCursesUI::~NCursesUI()
{ {
enable_mouse(false); enable_mouse(false);
if (can_change_color()) // try to reset palette
{
fputs("\033]104;\007", stdout);
fflush(stdout);
}
endwin(); endwin();
set_signal_handler(SIGWINCH, SIG_DFL); set_signal_handler(SIGWINCH, SIG_DFL);
set_signal_handler(SIGCONT, SIG_DFL); set_signal_handler(SIGCONT, SIG_DFL);