First of all, thank you so much for creating this amazing tutorial. I went through the tutorial, built my own kilo, and now I'm trying to implement all the functions listed in the Appendix. However, I'm stuck on "soft-wrap lines."
What I came up with is making render an array of strings. Then, every time I update a row, I split the characters into an array. But when doing so, it gets complicated very quickly. The hl array also needs to change to an array type since it syncs with render. I end up dealing with a lot of malloc and realloc calls, and I need to introduce a new state, ry, to track the cursor's vertical coordinate.
So, I wonder if there is any simpler way to implement this?
First of all, thank you so much for creating this amazing tutorial. I went through the tutorial, built my own
kilo, and now I'm trying to implement all the functions listed in the Appendix. However, I'm stuck on "soft-wrap lines."What I came up with is making
renderan array of strings. Then, every time I update a row, I split the characters into an array. But when doing so, it gets complicated very quickly. Thehlarray also needs to change to an array type since it syncs withrender. I end up dealing with a lot ofmallocandrealloccalls, and I need to introduce a new state,ry, to track the cursor's vertical coordinate.So, I wonder if there is any simpler way to implement this?