summaryrefslogtreecommitdiff
path: root/src/ncurses.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2012-10-28 09:26:54 +0100
committerMaxime Coste <frrrwww@gmail.com>2012-10-28 09:26:54 +0100
commitd9729cc29eb717aae2c68ced24d4b04d4c2ea4cf (patch)
treedfa12788197425cd8c02d1b5a7c10078b2ac4cff /src/ncurses.cc
parent13a081ed4ab770c80e6a258b6aa507ca55df3529 (diff)
Handle all available input before redrawing
Diffstat (limited to 'src/ncurses.cc')
-rw-r--r--src/ncurses.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ncurses.cc b/src/ncurses.cc
index a7c2a3e5..1cbfbf1f 100644
--- a/src/ncurses.cc
+++ b/src/ncurses.cc
@@ -211,6 +211,16 @@ struct getch_iterator
getch_iterator& operator++(int) { return *this; }
};
+bool NCursesUI::is_key_available()
+{
+ timeout(0);
+ const int c = getch();
+ if (c != ERR)
+ ungetch(c);
+ timeout(-1);
+ return c != ERR;
+}
+
Key NCursesUI::get_key()
{
const unsigned c = getch();