diff --git a/src/terminal_ui.cc b/src/terminal_ui.cc index 3ad95e407..52a25e261 100644 --- a/src/terminal_ui.cc +++ b/src/terminal_ui.cc @@ -702,7 +702,7 @@ Optional TerminalUI::get_next_key() static constexpr auto control = [](char c) { return c & 037; }; - static auto convert = [this](Codepoint c) -> Codepoint { + auto convert = [this](Codepoint c) -> Codepoint { if (c == control('m') or c == control('j')) return Key::Return; if (c == control('i')) @@ -717,7 +717,7 @@ Optional TerminalUI::get_next_key() return Key::Escape; return c; }; - static auto parse_key = [](unsigned char c) -> Key { + auto parse_key = [&convert](unsigned char c) -> Key { if (Codepoint cp = convert(c); cp > 255) return Key{cp}; // Special case: you can type NUL with Ctrl-2 or Ctrl-Shift-2 or @@ -756,7 +756,7 @@ Optional TerminalUI::get_next_key() return mod; }; - auto parse_csi = [this]() -> Optional { + auto parse_csi = [this, &convert]() -> Optional { auto next_char = [] { return get_char().value_or((unsigned char)0xff); }; int params[16][4] = {}; auto c = next_char();