From 6e879c9db9612a777bcd0ee009f3dca059124b72 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Wed, 24 Oct 2018 08:53:01 +0200 Subject: Defer keypad() invocation --- sdn.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sdn.cpp b/sdn.cpp index ad72f98..9a1f5c8 100644 --- a/sdn.cpp +++ b/sdn.cpp @@ -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 (); -- cgit v1.2.3-70-g09d2