Fix color restoring
This commit is contained in:
parent
ad2aa35546
commit
a2b4bf09fd
|
@ -140,9 +140,6 @@ constexpr struct { unsigned char r, g, b; } builtin_colors[] = {
|
||||||
|
|
||||||
static void restore_colors()
|
static void restore_colors()
|
||||||
{
|
{
|
||||||
if (not can_change_color())
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (size_t i = 8; i < COLORS; ++i)
|
for (size_t i = 8; i < COLORS; ++i)
|
||||||
{
|
{
|
||||||
auto& c = builtin_colors[i];
|
auto& c = builtin_colors[i];
|
||||||
|
@ -287,7 +284,9 @@ NCursesUI::~NCursesUI()
|
||||||
{
|
{
|
||||||
puts("\033[?1004l");
|
puts("\033[?1004l");
|
||||||
puts("\033[?1002l");
|
puts("\033[?1002l");
|
||||||
|
const bool changed_color = can_change_color();
|
||||||
endwin();
|
endwin();
|
||||||
|
if (changed_color)
|
||||||
restore_colors();
|
restore_colors();
|
||||||
signal(SIGWINCH, SIG_DFL);
|
signal(SIGWINCH, SIG_DFL);
|
||||||
signal(SIGINT, SIG_DFL);
|
signal(SIGINT, SIG_DFL);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user