Fix 'error: non-constant-expression cannot be narrowed...'

ncurses_ui.cc:759:59: error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'Key::MouseButton' in initializer list [-Wc++11-narrowing]
                return mouse_button(mod, Key::MouseButton{code}, coord, c == 'm');
                                                          ^~~~
This commit is contained in:
Igor Böhm 2020-06-28 23:32:12 +02:00
parent d3374e7e5f
commit d79b005323

View File

@ -753,7 +753,7 @@ Optional<Key> NCursesUI::get_next_key()
const int y = (sgr ? params[2] : next_char() - 32) - 1; const int y = (sgr ? params[2] : next_char() - 32) - 1;
auto coord = encode_coord({y - content_line_offset(), x}); auto coord = encode_coord({y - content_line_offset(), x});
Key::Modifiers mod = parse_mask((b >> 2) & 0x7); Key::Modifiers mod = parse_mask((b >> 2) & 0x7);
switch (auto code = b & 0x43; code) switch (const int code = b & 0x43; code)
{ {
case 0: case 1: case 2: case 0: case 1: case 2:
return mouse_button(mod, Key::MouseButton{code}, coord, c == 'm'); return mouse_button(mod, Key::MouseButton{code}, coord, c == 'm');