Update raygui.h

This commit is contained in:
Ray
2025-11-11 19:38:38 +01:00
parent 860e46d3f8
commit d4ebcdc2be

View File

@ -2590,7 +2590,7 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
int pasteLength = 0; int pasteLength = 0;
int pasteCodepoint; int pasteCodepoint;
int pasteCodepointSize; int pasteCodepointSize;
// Count how many codepoints to copy, stopping at the first unwanted control character // Count how many codepoints to copy, stopping at the first unwanted control character
while (true) while (true)
{ {
@ -2599,7 +2599,7 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
if (!(multiline && (pasteCodepoint == (int)'\n')) && !(pasteCodepoint >= 32)) break; if (!(multiline && (pasteCodepoint == (int)'\n')) && !(pasteCodepoint >= 32)) break;
pasteLength += pasteCodepointSize; pasteLength += pasteCodepointSize;
} }
if (pasteLength > 0) if (pasteLength > 0)
{ {
// Move forward data from cursor position // Move forward data from cursor position
@ -2662,7 +2662,7 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
while (offset < textLength) while (offset < textLength)
{ {
if (!isspace(nextCodepoint & 0xff)) break; if (!isspace(nextCodepoint & 0xff)) break;
offset += nextCodepointSize; offset += nextCodepointSize;
accCodepointSize += nextCodepointSize; accCodepointSize += nextCodepointSize;
nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize); nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize);
@ -2673,11 +2673,11 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
textLength -= accCodepointSize; textLength -= accCodepointSize;
} }
else if ((textLength > textBoxCursorIndex) && (IsKeyPressed(KEY_DELETE) || (IsKeyDown(KEY_DELETE) && autoCursorShouldTrigger))) else if ((textLength > textBoxCursorIndex) && (IsKeyPressed(KEY_DELETE) || (IsKeyDown(KEY_DELETE) && autoCursorShouldTrigger)))
{ {
// Delete single codepoint from text, after current cursor position // Delete single codepoint from text, after current cursor position
int nextCodepointSize = 0; int nextCodepointSize = 0;
GetCodepointNext(text + textBoxCursorIndex, &nextCodepointSize); GetCodepointNext(text + textBoxCursorIndex, &nextCodepointSize);
@ -2704,7 +2704,7 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
offset -= prevCodepointSize; offset -= prevCodepointSize;
accCodepointSize += prevCodepointSize; accCodepointSize += prevCodepointSize;
} }
// Check characters of the same type to delete (either ASCII punctuation or anything non-whitespace) // Check characters of the same type to delete (either ASCII punctuation or anything non-whitespace)
// Not using isalnum() since it only works on ASCII characters // Not using isalnum() since it only works on ASCII characters
bool puctuation = ispunct(prevCodepoint & 0xff); bool puctuation = ispunct(prevCodepoint & 0xff);
@ -2723,11 +2723,11 @@ int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
textLength -= accCodepointSize; textLength -= accCodepointSize;
textBoxCursorIndex -= accCodepointSize; textBoxCursorIndex -= accCodepointSize;
} }
else if ((textBoxCursorIndex > 0) && (IsKeyPressed(KEY_BACKSPACE) || (IsKeyDown(KEY_BACKSPACE) && autoCursorShouldTrigger))) else if ((textBoxCursorIndex > 0) && (IsKeyPressed(KEY_BACKSPACE) || (IsKeyDown(KEY_BACKSPACE) && autoCursorShouldTrigger)))
{ {
// Delete single codepoint from text, before current cursor position // Delete single codepoint from text, before current cursor position
int prevCodepointSize = 0; int prevCodepointSize = 0;
GetCodepointPrevious(text + textBoxCursorIndex, &prevCodepointSize); GetCodepointPrevious(text + textBoxCursorIndex, &prevCodepointSize);
@ -3224,9 +3224,9 @@ int GuiValueBoxFloat(Rectangle bounds, const char *text, char *textValue, float
textValue[1] = '\0'; textValue[1] = '\0';
keyCount++; keyCount++;
} }
for (int i = keyCount; i > -1; i--) textValue[i + 1] = textValue[i]; for (int i = keyCount; i > -1; i--) textValue[i + 1] = textValue[i];
textValue[0] = '-'; textValue[0] = '-';
keyCount++; keyCount++;
valueHasChanged = true; valueHasChanged = true;