mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-26 12:37:06 +08:00
Make DEL to be a special character.
This commit is contained in:
parent
65e7fae7df
commit
e1efcf2d97
@ -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));
|
||||||
|
@ -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
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user