Win IME: Ideographic Full Stop to Decimal Point

Convert Ideographic Full Stop, used in Simplified Chinese and Japanese,
to Decimal Point when entering numbers into numerical inputs.

See D13903 for more details

Differential Revision: https://developer.blender.org/D13903

Reviewed by Brecht Van Lommel
This commit is contained in:
Harley Acheson 2022-01-28 13:11:56 -08:00
parent ace1b6a73a
commit 4311a32bc2
Notes: blender-bot 2023-02-14 09:44:56 +01:00
Referenced by issue #93626, Can't input '. ' in Transform input box (when using IME)
1 changed files with 8 additions and 1 deletions

View File

@ -3957,7 +3957,14 @@ static void ui_do_but_textedit(
ui_textedit_delete_selection(but, data);
}
if (event->type == WM_IME_COMPOSITE_EVENT && ime_data->result_len) {
ui_textedit_insert_buf(but, data, ime_data->str_result, ime_data->result_len);
if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER) &&
strcmp(ime_data->str_result, "\xE3\x80\x82") == 0) {
/* Convert Ideographic Full Stop (U+3002) to decimal point when entering numbers. */
ui_textedit_insert_ascii(but, data, '.');
}
else {
ui_textedit_insert_buf(but, data, ime_data->str_result, ime_data->result_len);
}
}
}
else if (event->type == WM_IME_COMPOSITE_END) {