Make DEL to be a special character.

This commit is contained in:
ArthurSonzogni 2019-07-02 23:09:20 +02:00
parent 65e7fae7df
commit e1efcf2d97
3 changed files with 9 additions and 2 deletions

View File

@ -19,7 +19,11 @@ class DrawKey : public Component {
for(auto& it : keys[i].input()) for(auto& it : keys[i].input())
code += L" " + std::to_wstring((unsigned int)it); code += L" " + std::to_wstring((unsigned int)it);
code = L"(" + code + L" ) -> " + keys[i].character() + L")"; code = L"(" + code + L" ) -> ";
if (keys[i].is_character())
code += keys[i].character();
else
code += L"(special)";
children.push_back(text(code)); children.push_back(text(code));
} }
return vbox(std::move(children)); return vbox(std::move(children));

View File

@ -49,7 +49,7 @@ struct Event {
private: private:
std::string input_; std::string input_;
bool is_character_ = false; bool is_character_ = false;
wchar_t character_ = '?'; wchar_t character_ = U'?';
}; };
} // namespace ftxui } // namespace ftxui

View File

@ -122,6 +122,9 @@ Event Event::GetEvent(std::function<char()> getchar) {
if (input[0] >= 0 && input[0] < 32) // C0 if (input[0] >= 0 && input[0] < 32) // C0
return Event::Special(input); return Event::Special(input);
if (input[0] == 127) // Delete
return Event::Special(input);
return ParseUTF8(getchar, input); return ParseUTF8(getchar, input);
} }