windows: Remove unneeded ranges for replace_and_mark_text_in_range
(#30668)
Release Notes: - N/A
This commit is contained in:
parent
25cc05b45c
commit
22f76ac1a7
1 changed files with 4 additions and 9 deletions
|
@ -755,13 +755,9 @@ fn handle_ime_composition_inner(
|
||||||
) -> Option<isize> {
|
) -> Option<isize> {
|
||||||
let mut ime_input = None;
|
let mut ime_input = None;
|
||||||
if lparam.0 as u32 & GCS_COMPSTR.0 > 0 {
|
if lparam.0 as u32 & GCS_COMPSTR.0 > 0 {
|
||||||
let (comp_string, string_len) = parse_ime_compostion_string(ctx)?;
|
let comp_string = parse_ime_compostion_string(ctx)?;
|
||||||
with_input_handler(&state_ptr, |input_handler| {
|
with_input_handler(&state_ptr, |input_handler| {
|
||||||
input_handler.replace_and_mark_text_in_range(
|
input_handler.replace_and_mark_text_in_range(None, &comp_string, None);
|
||||||
None,
|
|
||||||
&comp_string,
|
|
||||||
Some(string_len..string_len),
|
|
||||||
);
|
|
||||||
})?;
|
})?;
|
||||||
ime_input = Some(comp_string);
|
ime_input = Some(comp_string);
|
||||||
}
|
}
|
||||||
|
@ -1448,7 +1444,7 @@ fn parse_char_msg_keystroke(wparam: WPARAM) -> Option<Keystroke> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_ime_compostion_string(ctx: HIMC) -> Option<(String, usize)> {
|
fn parse_ime_compostion_string(ctx: HIMC) -> Option<String> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let string_len = ImmGetCompositionStringW(ctx, GCS_COMPSTR, None, 0);
|
let string_len = ImmGetCompositionStringW(ctx, GCS_COMPSTR, None, 0);
|
||||||
if string_len >= 0 {
|
if string_len >= 0 {
|
||||||
|
@ -1463,8 +1459,7 @@ fn parse_ime_compostion_string(ctx: HIMC) -> Option<(String, usize)> {
|
||||||
buffer.as_mut_ptr().cast::<u16>(),
|
buffer.as_mut_ptr().cast::<u16>(),
|
||||||
string_len as usize / 2,
|
string_len as usize / 2,
|
||||||
);
|
);
|
||||||
let string = String::from_utf16_lossy(wstring);
|
Some(String::from_utf16_lossy(wstring))
|
||||||
Some((string, string_len as usize / 2))
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue