Hacker News new | ask | show | jobs
by vivzkestrel 205 days ago
When I see posts like this, I cant help but ask. How do you even build a code editor? What kinda of system design or OOP does it require. I couldnt find articles on HN searching for it so if anyone is reading, I super appreciate if you can share some links where talk about the methodology and thought process that goes into how to make a code editor from scratch
2 comments

One great way to start learning is to code your own! Here's a step-by-step guide to writing a TUI text editor in ~1000 lines of code (and it's super easy to embellish as you go): https://viewsourcecode.org/snaptoken/kilo/
For internals a lot of text editors use ropes as the core data structure, which makes text buffers fast.

https://en.wikipedia.org/wiki/Rope_(data_structure) https://github.com/cessen/ropey