diff --git a/src/main.rs b/src/main.rs index 34bf078..2615820 100644 --- a/src/main.rs +++ b/src/main.rs @@ -638,7 +638,7 @@ fn handle_window_event( } WindowEvent::ReceivedCharacter(codepoint) => { - if !game.focused { + if !game.focused && !game.is_ctrl_pressed && !game.is_logo_pressed { ui_container.key_type(game, codepoint); } } diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 4796c6d..88d51d4 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -1537,9 +1537,6 @@ impl UIElement for TextBox { ctrl_pressed: bool, ) { match (key, down) { - (VirtualKeyCode::Back, _) => { - self.input.pop(); - } (VirtualKeyCode::Return, false) => { use std::mem; let len = self.submit_funcs.len(); @@ -1564,6 +1561,12 @@ impl UIElement for TextBox { } fn key_type(&mut self, _game: &mut crate::Game, c: char) { + if c == '\x7f' || c == '\x08' { + // Backspace + self.input.pop(); + return; + } + self.input.push(c); }