From 8e52aee8531f1069f1774856e2046fe514ac2589 Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 5 Sep 2025 00:13:32 +0200 Subject: [PATCH] Update rtext.c --- src/rtext.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rtext.c b/src/rtext.c index c1056d22e..60c2c1f18 100644 --- a/src/rtext.c +++ b/src/rtext.c @@ -1461,15 +1461,16 @@ char **LoadTextLines(const char *text, int *count) } char **lines = (char **)RL_CALLOC(lineCount, sizeof(char *)); - for (int i = 0, l = 0, lineLen = 0; i <= textSize; i++, lineLen++) + for (int i = 0, l = 0, lineLen = 0; i <= textSize; i++) { if ((text[i] == '\n') || (text[i] == '\0')) { lines[l] = (char *)RL_CALLOC(lineLen + 1, 1); - strncpy(lines[l], &text[i - lineLen + 1], lineLen - 1); + strncpy(lines[l], &text[i - lineLen], lineLen); lineLen = 0; l++; } + else lineLen++; } *count = lineCount;