Implement key Delete in component > Input.

The BS  key is used to delete the character on the left of the cursor.
The DEL key is used to delete the character on the right of the cursor.

BackSpace was already implemented. This CL implements DEL.

This is related to bug:
https://github.com/ArthurSonzogni/FTXUI/issues/4
This commit is contained in:
ArthurSonzogni 2019-07-01 00:40:55 +02:00
parent 32871fcc6b
commit 01ab335919

View File

@ -52,6 +52,14 @@ bool Input::OnEvent(Event event) {
return true;
}
// Delete
if (event == Event::Delete) {
if (cursor_position == int(content.size()))
return false;
content.erase(cursor_position, 1);
return true;
}
// Enter.
if (event == Event::Return) {
on_enter();