When inserting text using IME on a button, the character after the cursor is displayed before the cursor.
This bug seems to have occurred during the refactoring of the source code.
https://developer.blender.org/D765?vs=2730&id=2939#toc
In D765 (id 2730)
the original code was
char *str; size_t len, slen; len = strlen(but->editstr); slen = ime->composite_len; str = MEM_mallocN(sizeof(char) * (slen + len + 1), "drawstr edit buffer"); memcpy(str, but->editstr, sizeof(char) * but->pos); memcpy(str + but->pos, ime->composite, sizeof(char) * slen); memcpy(str + but->pos + slen, but->editstr + but->pos, sizeof(char) + (len - but->pos)); str[len + slen] = '\0'; drawstr = drawstr_edit = str;
According to the meaning of original source code, I use the precision specification for BLI_snprintf, and the string will be displayed correctly.