Defer keypad() invocation

This commit is contained in:
Přemysl Eric Janouch 2018-10-24 08:53:01 +02:00
parent 45f79abf9c
commit 6e879c9db9
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 9 additions and 2 deletions

11
sdn.cpp
View File

@ -814,8 +814,7 @@ int main (int argc, char *argv[]) {
}
locale::global (locale (""));
if (!initscr () || cbreak () == ERR || noecho () == ERR || nonl () == ERR
|| halfdelay (1) == ERR || keypad (stdscr, TRUE) == ERR) {
if (!initscr () || cbreak () == ERR || noecho () == ERR || nonl () == ERR) {
cerr << "cannot initialize screen" << endl;
return 1;
}
@ -825,6 +824,14 @@ int main (int argc, char *argv[]) {
g.start_dir = g.cwd;
update ();
// Invoking keypad() earlier would make ncurses flush its output buffer,
// which would worsen start-up flickering
if (halfdelay (1) == ERR || keypad (stdscr, TRUE) == ERR) {
endwin ();
cerr << "cannot initialize screen" << endl;
return 1;
}
wint_t c;
while (1) {
inotify_check ();