InputText: Fixed callback's helper DeleteChars() function when cursor is inside the deleted block. (#3454).

This commit is contained in:
ocornut
2020-09-03 19:09:57 +02:00
parent 70289ab42c
commit 751d153ca9
3 changed files with 6 additions and 3 deletions

View File

@ -3620,7 +3620,7 @@ void ImGuiInputTextCallbackData::DeleteChars(int pos, int bytes_count)
*dst++ = c;
*dst = '\0';
if (CursorPos + bytes_count >= pos)
if (CursorPos >= pos + bytes_count)
CursorPos -= bytes_count;
else if (CursorPos >= pos)
CursorPos = pos;