summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJay McCarthy <jay.mccarthy@gmail.com>2018-11-29 13:42:47 -0500
committerJay McCarthy <jay.mccarthy@gmail.com>2018-12-07 16:33:35 -0500
commit4cac29d98c5dd707eed226a0591a9c745d46509f (patch)
treee5fbdb937bfbd8297b97d6fbc3643e96143c4169 /src
parentaf5d2d95235c677ab4e80103f1e2dd4a6fd65d87 (diff)
Update re lenormf's comments
Diffstat (limited to 'src')
-rw-r--r--src/ncurses_ui.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc
index 519910c1..b93f8309 100644
--- a/src/ncurses_ui.cc
+++ b/src/ncurses_ui.cc
@@ -26,6 +26,7 @@ namespace Kakoune
using std::min;
using std::max;
+using std::function;
struct NCursesWin : WINDOW {};
@@ -671,11 +672,12 @@ Optional<Key> NCursesUI::get_next_key()
const Codepoint c2 = wgetch(m_window);
if ( c2 != ';' )
{
- ungetch(c2); ungetch(c1); break;
+ ungetch(c2); ungetch(c1);
+ break;
}
const Codepoint c3 = wgetch(m_window);
- Key (*f)(Key) = NULL;
+ function<Key(Key)> f = nullptr;
switch (c3)
{
case '2': f = shift; break;
@@ -686,9 +688,10 @@ Optional<Key> NCursesUI::get_next_key()
case '7': f = alt_ctrl; break;
case '8': f = shift_alt_ctrl; break;
}
- if ( f == NULL )
+ if ( f == nullptr )
{
- ungetch(c3); ungetch(c2); ungetch(c1); break;
+ ungetch(c3); ungetch(c2); ungetch(c1);
+ break;
}
const Codepoint c4 = wgetch(m_window);
@@ -702,10 +705,12 @@ Optional<Key> NCursesUI::get_next_key()
case 'F': return f(Key::End);
}
- ungetch(c4); ungetch(c3); ungetch(c2); ungetch(c1); break;
+ ungetch(c4); ungetch(c3); ungetch(c2); ungetch(c1);
+ break;
}
default:
- ungetch(c1); break;
+ ungetch(c1);
+ break;
}
}
wtimeout(m_window, -1);