windows: Fix crash in vim normal mode when IME key is pressed (#11387)

Fixed crash in vim normal mode when ime key press.

Release Notes:

- N/A
This commit is contained in:
CharlesChen0823 2024-05-07 04:31:49 +08:00 committed by GitHub
parent 9edd81c740
commit 530bc5c99e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -790,8 +790,7 @@ impl WindowsWindowInner {
let Some(mut input_handler) = self.input_handler.take() else {
return Some(1);
};
// we are composing, this should never fail
let caret_range = input_handler.selected_text_range().unwrap();
let caret_range = input_handler.selected_text_range().unwrap_or_default();
let caret_position = input_handler.bounds_for_range(caret_range).unwrap();
self.input_handler.set(Some(input_handler));
let scale_factor = self.scale_factor.get();