More cross-platform, cross-terminal-emulator resize compatibility fixes.

This commit is contained in:
Casey Langen 2020-12-31 15:08:04 -08:00
parent 0951d87add
commit 5c7415bc45

View File

@ -63,6 +63,7 @@ using namespace std::chrono;
static OverlayStack overlays;
static bool disconnected = false;
static bool resized = false;
static App* instance = nullptr;
@ -71,6 +72,11 @@ static void hangupHandler(int signal) {
disconnected = true;
}
static void resizedHandler(int signal) {
endwin(); /* required in *nix because? */
resized = true;
}
static std::string getEnvironmentVariable(const std::string& name) {
std::string result;
const char* value = std::getenv(name.c_str());
@ -249,6 +255,7 @@ App::App(const std::string& title) {
#else
setlocale(LC_ALL, "");
std::signal(SIGHUP, hangupHandler);
std::signal(SIGWINCH, resizedHandler);
std::signal(SIGPIPE, SIG_IGN);
this->colorMode = Colors::Palette;
#endif
@ -501,7 +508,6 @@ void App::Run(ILayoutPtr layout) {
this->state.keyHandler = nullptr;
int lastWidth = Screen::GetWidth();
int lastHeight = Screen::GetHeight();
bool resized = false;
this->ChangeLayout(layout);