Skip to content

gui_text_box, gui_value_box_float, gui_text_input_box now take a mut buffer - #30

Open
nepinhum wants to merge 5 commits into
vlang:mainfrom
nepinhum:fix/raygui-text-buffers
Open

gui_text_box, gui_value_box_float, gui_text_input_box now take a mut buffer#30
nepinhum wants to merge 5 commits into
vlang:mainfrom
nepinhum:fix/raygui-text-buffers

Conversation

@nepinhum

@nepinhum nepinhum commented Aug 6, 2026

Copy link
Copy Markdown

Summary

Closes #29.

gui_text_box couldn't actually be edited because its text parameter was
bound as a V string and passed to C as .str. V strings are immutable and
sized to their exact contents but GuiTextBox() writes directly into that
pointer while editMode is on. So editing either silently did nothing or wrote past the string's allocation.

  • scripts/raygen.py is updated to distinguish const char *
    (still becomes a V string) from plain char * (now becomes &u8). Regenerating the bindings later won't reintroduce this bug.

@Wajinn

Wajinn commented Aug 10, 2026

Copy link
Copy Markdown

@spytheman, @EmmaTheMartian, @medvednikov

It might be more convenient for users to have both the string and &u8 type as parameters in the same function, but understand if only &u8.

May want to double check solutions against a V version of the controls test suite.

@nepinhum

Copy link
Copy Markdown
Author

I currently don’t have access to my PC, so many thanks to @xRookieFight for contributing the follow up changes and running the interactive tests.

Using the added raygui_controls.v example, the proposed &u8 bindings were tested with V 0.5.2 (282bf30 and 8dc873b)

GuiTextBox, GuiValueBoxFloat and GuiTextInputBox all accepted edits and correctly updated their V side backing buffers. Backspace and capacity limits also behaved correctly with no observed overflow so far.

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

Successfully merging this pull request may close these issues.

The function gui_text_box might need an extra parameter

3 participants