mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-13 14:38:36 +00:00
Fix backspace for text entry fields.
The original problem was that hitting backspace would insert 0x7f, and then delete it. This prevented deleting the intended character.
This commit is contained in:
parent
00a724283e
commit
fda30fd528
@ -313,7 +313,13 @@ impl WinitPlatform {
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
WindowEvent::ReceivedCharacter(ch) => io.add_input_character(ch),
|
||||
WindowEvent::ReceivedCharacter(ch) => {
|
||||
// Exclude the backspace key ('\u{7f}'). Otherwise we will insert this char and then
|
||||
// delete it.
|
||||
if ch != '\u{7f}' {
|
||||
io.add_input_character(ch)
|
||||
}
|
||||
}
|
||||
WindowEvent::CursorMoved { position, .. } => {
|
||||
let position = self.scale_pos_from_winit(window, position);
|
||||
io.mouse_pos = [position.x as f32, position.y as f32];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user