#Is there something like `strings.write_rune_at` ?
1 messages · Page 1 of 1 (latest)
No because that's usually a sign that you've done something wrong.
Why are you going back to insert a rune in the builder? Why didn't you write the rune in the first place?
Right now I'm trying to make an editor and use cursor position to dynamically update string buffer depending where the cursor is at the moment and what char user types.
Have you checked out core:text/edit?
That might solve the problem for you already.
Oh! Just went through the list of core libraries and somehow missed that one.
Thank you so much, I will check that out!
Storing text as a sequential array of characters is a bad idea for text editors for precisely this reason. You might want to consider looking into https://en.wikipedia.org/wiki/Rope_(data_structure) and https://en.wikipedia.org/wiki/Gap_buffer