summaryrefslogtreecommitdiff
path: root/src/ncurses_ui.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-09-12 10:54:55 +0100
committerMaxime Coste <frrrwww@gmail.com>2015-09-12 10:54:55 +0100
commita2b4bf09fdd2bbb914ef92158e7befdd63254dad (patch)
tree6a3ee629cce537978737c3145ba74bdb58261e99 /src/ncurses_ui.cc
parentad2aa35546541d03665953b65583ed00f4164034 (diff)
Fix color restoring
Diffstat (limited to 'src/ncurses_ui.cc')
-rw-r--r--src/ncurses_ui.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc
index 8f6e195f..a29bf702 100644
--- a/src/ncurses_ui.cc
+++ b/src/ncurses_ui.cc
@@ -140,9 +140,6 @@ constexpr struct { unsigned char r, g, b; } builtin_colors[] = {
static void restore_colors()
{
- if (not can_change_color())
- return;
-
for (size_t i = 8; i < COLORS; ++i)
{
auto& c = builtin_colors[i];
@@ -287,8 +284,10 @@ NCursesUI::~NCursesUI()
{
puts("\033[?1004l");
puts("\033[?1002l");
+ const bool changed_color = can_change_color();
endwin();
- restore_colors();
+ if (changed_color)
+ restore_colors();
signal(SIGWINCH, SIG_DFL);
signal(SIGINT, SIG_DFL);
}