fix error in textinsert, found by github user chrg127

This commit is contained in:
CrackedPixel 2026-03-11 12:17:57 -05:00
parent 6cebf63cba
commit 83b0acbd66

View File

@ -1875,7 +1875,7 @@ char *TextInsert(const char *text, const char *insert, int position)
result = (char *)RL_MALLOC(textLen + insertLen + 1); result = (char *)RL_MALLOC(textLen + insertLen + 1);
for (int i = 0; i < position; i++) result[i] = text[i]; for (int i = 0; i < position; i++) result[i] = text[i];
for (int i = position; i < insertLen + position; i++) result[i] = insert[i]; for (int i = position; i < insertLen + position; i++) result[i] = insert[i - position];
for (int i = (insertLen + position); i < (textLen + insertLen); i++) result[i] = text[i]; for (int i = (insertLen + position); i < (textLen + insertLen); i++) result[i] = text[i];
result[textLen + insertLen] = '\0'; // Add EOL result[textLen + insertLen] = '\0'; // Add EOL