fix non-ascii input causing crashes
This commit is contained in:
parent
040b3d3779
commit
90d2e35ade
1 changed files with 8 additions and 1 deletions
|
@ -445,7 +445,14 @@ impl Editor {
|
|||
let input_x = 560;
|
||||
let width = d.get_screen_width();
|
||||
if self.input_as_text {
|
||||
let mut input_text = String::from_utf8_lossy(self.machine.input()).to_string();
|
||||
let mut input_text = String::new();
|
||||
for &byte in self.machine.input() {
|
||||
if byte.is_ascii_graphic() || byte == b' ' {
|
||||
input_text.push(byte as char);
|
||||
} else {
|
||||
input_text.push('\\');
|
||||
}
|
||||
}
|
||||
if text_input(
|
||||
d,
|
||||
Rectangle::new(input_x as f32, 5., (width - input_x - 5) as f32, 30.),
|
||||
|
|
Loading…
Reference in a new issue