From aef88fd9eb8d3969ad4352f17b6532195d30771d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 20 Mar 2017 17:16:35 +0100 Subject: [PATCH] screen_utils: move check to ignore_key() --- src/screen_utils.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/screen_utils.c b/src/screen_utils.c index 28d5e4b..891b9b3 100644 --- a/src/screen_utils.c +++ b/src/screen_utils.c @@ -38,6 +38,12 @@ screen_bell(void) flash(); } +static bool +ignore_key(int key) +{ + return key == ERR; +} + int screen_getch(const char *prompt) { @@ -52,8 +58,7 @@ screen_getch(const char *prompt) curs_set(1); int key; - while ((key = wgetch(w)) == ERR) - ; + while (ignore_key(key = wgetch(w))) {} #ifdef HAVE_GETMOUSE /* ignore mouse events */ -- 2.30.2