From 3778ff56a89eb20036114c843a20d7a56748d4b9 Mon Sep 17 00:00:00 2001 From: databasedav <31483365+databasedav@users.noreply.github.com> Date: Tue, 13 Aug 2024 00:49:12 -0700 Subject: [PATCH] fix spaces being ignored (#152) * handle spaces * fmt --- readme.md | 4 ++-- src/input.rs | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/readme.md b/readme.md index 15ac699..4c5c727 100644 --- a/readme.md +++ b/readme.md @@ -29,8 +29,8 @@ RUSTFLAGS=--cfg=web_sys_unstable_apis cargo r --target wasm32-unknown-unknown -- | bevy | bevy_cosmic_edit | | ------ | ---------------- | -| 0.14.0 | 0.22 - latest | -| 0.13.0 | 0.16 - 0.21 | +| 0.14.0 | 0.21 - latest | +| 0.13.0 | 0.16 - 0.20 | | 0.12.* | 0.15 | | 0.11.* | 0.8 - 0.14 | diff --git a/src/input.rs b/src/input.rs index a303d47..5d663ab 100644 --- a/src/input.rs +++ b/src/input.rs @@ -496,12 +496,18 @@ pub(crate) fn kb_input_text( && (max_chars.0 == 0 || buffer.get_text().len() < max_chars.0) && matches!(char_ev.state, bevy::input::ButtonState::Pressed) { - if let Key::Character(char) = &char_ev.logical_key { - let b = char.as_bytes(); - for c in b { - let c: char = (*c).into(); - editor.action(&mut font_system.0, Action::Insert(c)); + match &char_ev.logical_key { + Key::Character(char) => { + let b = char.as_bytes(); + for c in b { + let c: char = (*c).into(); + editor.action(&mut font_system.0, Action::Insert(c)); + } + } + Key::Space => { + editor.action(&mut font_system.0, Action::Insert(' ')); } + _ => (), } } } -- GitLab