From 308f916d9d5e827e534a67a90378d5f3fad81357 Mon Sep 17 00:00:00 2001 From: Ben Beshara Date: Tue, 4 Jun 2019 21:16:29 +1000 Subject: [PATCH] Fixed crash when editing textbox at non-end pos --- .gitignore | 4 +++- src/raygui.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index b882c2f..24abda9 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,6 @@ *.su !tools/rGuiLayout/release/win32/rguilayout.exe -!tools/rGuiStyler/release/win32/rguistyler.exe \ No newline at end of file +!tools/rGuiStyler/release/win32/rguistyler.exe + +.vscode/ \ No newline at end of file diff --git a/src/raygui.h b/src/raygui.h index 20d4472..ea2d94b 100644 --- a/src/raygui.h +++ b/src/raygui.h @@ -2334,7 +2334,7 @@ RAYGUIDEF bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editM int startIdx = GuiTextBoxGetByteIndex(text, 0, 0, guiTextBoxState.cursor); int endIdx = startIdx + sz; - if (endIdx <= textSize) + if (endIdx <= textSize && length < textSize - 1) { guiTextBoxState.cursor++; guiTextBoxState.select = -1;