Forcing a line break with draw_text_ext for strings without spaces?


I have a system in place right now where the player can type out a string, it reads the keyboard_string input and draws it with draw_text_ext, with the width set to the length of the textbox.

It works great, except for when it's spammed with a string with no spaces, then the line break doesn't occur, even after the width has been exceeded. I've tried storing the width of keyboard_string as another variable and checking to see if it's hit the textbox amount in pixels, and then adding a line break manually to the string in the character after it does, but that didn't give me any noticeable results.

Is there something simple I'm missing here or is there no easy way to do this?


The solution you tried is what should work, so maybe you messed up? I guess you would insert the string "\n" at some location if it's over that length.