Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Unicode input on GuiTextBox() #399

Open
electrolys opened this issue Apr 23, 2024 · 1 comment
Open

Issue with Unicode input on GuiTextBox() #399

electrolys opened this issue Apr 23, 2024 · 1 comment

Comments

@electrolys
Copy link

gui textbox doesn't handle adding and removing characters properly and causes an underflow (at adding) and overflow (at removal)

at lines

for (int i = (textBoxCursorIndex - prevCodepointSize); i < textLength; i++) text[i] = text[i + prevCodepointSize];

https://github.com/raysan5/raygui/blob/6f532337ff2d6dc14ba3a5f5b7ee63f9d90ff13b/src/raygui.h#L2562C21-L2562C113

you are just comparing the variable i with the text length or cursor when you really need to >= cursor+codepointsize and <= length-codepointsize

@raysan5
Copy link
Owner

raysan5 commented May 5, 2024

@electrolys Good catch! Please, could you send a PR with the fix! Thanks!

@raysan5 raysan5 changed the title Need to fix unicode input on GuiTextBox Issue with Unicode input on GuiTextBox() May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants