windows: Fix ctrl-r showing the control character (#34171)

Release Notes:

- N/A
This commit is contained in:
张小白 2025-07-10 09:15:33 +08:00 committed by GitHub
parent 08ffd9884a
commit a133c1311d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1248,7 +1248,9 @@ fn parse_char_message(wparam: WPARAM, state_ptr: &Rc<WindowsWindowStatePtr>) ->
}
_ => {
lock.pending_surrogate = None;
String::from_utf16(&[code_point]).ok()
char::from_u32(code_point as u32)
.filter(|c| !c.is_control())
.map(|c| c.to_string())
}
}
}