diff --git a/src/editor.rs b/src/editor.rs index 66b2c1b..832c6b2 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -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.),