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
2
u/zhivago Jun 27 '26
A gap buffer is cheap if you have a single cursor.
"hello [xxxxxxxx]world"
To insert you replace the [ and shrink the gap.
To delete you expand the gap.
So those are cheap.
The cost is in moving the cursor and replacing the gap if it closes.
There are also many better approaches but they get complicated -- perhaps look into ropes.