From 449776749246271ef6bb9f58ad100b28b34632c2 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 22 Jan 2013 14:29:16 +0100 Subject: [PATCH] NCursesUI::get_key(): move getch_iterator as a local type --- src/ncurses.cc | 13 ++++++------- 1 file 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;