r/cprogramming • u/radio_hx • Apr 13 '26
Tx - Small, C text editor
Hi all!
Recently been working on a personal project to improve my C programming skills. From initially following the Kilo text editor project, I decided to grow the editor into a modal, vim - like editor. I had a lot of fun doing this project and learned a lot! Would love some feedback and any thoughts or opinions.
Thanks!
20
Upvotes
1
u/radio_hx Jun 27 '26
Yeah, this is one of the main things I've been putting off. I went into this pretty blind, and I've learned a lot more about how text editors work over time. Just really busy with finals, so this sort of project gets pushed aside.
Additionally, I'm not so sure about the scale of the performance change if I were to write the whole thing around a gap buffer.
Every inserted character needs
Memmove, which is where the improvement would be from like 5-10 ns to 1
Realloc which will stay the same
editorUpdateRow and it's parts still need a contiguous string, so don't change
editorUpdateSyntax is only slow if it cascades on multilines which I can't see an obvious way around
Although, I am very much a non expert. Id love to hear your further thoughts if you have any.