Limit input size

This commit is contained in:
Artlef 2020-11-29 15:49:01 +01:00
parent 00ea1759d4
commit 55fe2fb538

View File

@ -392,10 +392,12 @@ fn start_keyboard_input_thread(
.unwrap(); .unwrap();
} }
Event::Key(Key::Char(c)) => { Event::Key(Key::Char(c)) => {
buffer.push_str(&c.to_string()); if buffer.len() < 10 {
display_sender buffer.push_str(&c.to_string());
.send(DisplayMessage::Input(Key::Char(c))) display_sender
.unwrap(); .send(DisplayMessage::Input(Key::Char(c)))
.unwrap();
}
} }
Event::Key(Key::Backspace) => { Event::Key(Key::Backspace) => {
buffer.pop(); buffer.pop();