summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-01-22 14:29:16 +0100
committerMaxime Coste <frrrwww@gmail.com>2013-01-22 14:29:16 +0100
commit449776749246271ef6bb9f58ad100b28b34632c2 (patch)
tree2898e1c245172255b0ab7160ac969a8ab90eecbb /src
parent0c8832c42a8b60883e985be968daad462d8f7c1a (diff)
NCursesUI::get_key(): move getch_iterator as a local type
Diffstat (limited to 'src')
-rw-r--r--src/ncurses.cc13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/ncurses.cc b/src/ncurses.cc
index 697b192c..c5207cef 100644
--- a/src/ncurses.cc
+++ b/src/ncurses.cc
@@ -225,13 +225,6 @@ void NCursesUI::draw(const DisplayBuffer& display_buffer,
redraw();
}
-struct getch_iterator
-{
- int operator*() { return getch(); }
- getch_iterator& operator++() { return *this; }
- getch_iterator& operator++(int) { return *this; }
-};
-
bool NCursesUI::is_key_available()
{
timeout(0);
@@ -286,6 +279,12 @@ Key NCursesUI::get_key()
if (c >= 0 and c < 256)
{
ungetch(c);
+ struct getch_iterator
+ {
+ int operator*() { return getch(); }
+ getch_iterator& operator++() { return *this; }
+ getch_iterator& operator++(int) { return *this; }
+ };
return utf8::codepoint(getch_iterator{});
}
return Key::Invalid;