summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2019-09-16 21:57:53 +1000
committerMaxime Coste <mawww@kakoune.org>2019-09-16 21:57:53 +1000
commitc787128a7c49555c8d1d49bd246dc9df92a5370b (patch)
treede8296b326f57019672f0b110513d5e8d894b032 /src
parentbfc07b53a2bd86788f68c1e5b653f6d6ca078320 (diff)
Restore palette before suspend
Diffstat (limited to 'src')
-rw-r--r--src/ncurses_ui.cc9
-rw-r--r--src/ncurses_ui.hh1
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);
};