Refactor: BLF Extract Function BLF_str_offset_to_cursor #120622

Merged
Harley Acheson merged 5 commits from Harley/blender:Offset2Cursor into main 2024-04-15 18:29:36 +02:00
2 changed files with 4 additions and 4 deletions
Showing only changes of commit 41ac8a912f - Show all commits

View File

@ -1105,10 +1105,10 @@ int blf_str_offset_to_cursor(
else if (prev.xmax && next.xmax) {
/* Middle of the string, so in between. */
if (next.xmin >= prev.xmax) {
return int((prev.xmax + next.xmin - cursor_width) / 2.0f);
return int((float(prev.xmax + next.xmin) - cursor_width) / 2.0f);
}
/* Possible with RTL. */
return int((next.xmax + prev.xmin - cursor_width) / 2.0f);
return int((float(next.xmax + prev.xmin) - cursor_width) / 2.0f);
}
else if (!str_offset) {
/* Before first space character. */

View File

@ -2019,8 +2019,8 @@ static void widget_draw_text(const uiFontStyle *fstyle,
/* IME candidate window uses cursor position. */
if (!ime_reposition_window) {
ime_reposition_window = true;
ime_win_x = but_cursor_shape.xmax + 5;
ime_win_y = but_cursor_shape.ymin + 3;
ime_win_x = rect->xmin + t + 5;
ime_win_y = rect->ymin + 3;
}
#endif
}