<- Back
Comments (144)
- tzsSometime around 1980-81 I had a part time job while an undergraduate in college doing system programming/admin for the Caltech High Energy Physics department.Rob Pike was the system programmer/admin before me when he was a grad student in high energy physics, but he left to go work at Bell Labs.One day another student, Karl Heuer, and I both were engaging in the common programmer pastime of complaining about the screen editors of the day and saying we could write something better.Somehow this turned into a competition, and we both spent all night racing against each other writing our editors. It was mostly silent except for the typing, interrupted by the occasional announcement of some feature that was now working to hopefully rattle the other.In the morning the other student system programmer/admin, Norman Wilson, got in and saw what Karl and I had been up to.Norman mentioned this in an email to Rob Pike. His response was something close to this:> Everyone writes a screen editor. It's easy to do and makes them feel important. Tell them to work on something useful.It was only a couple years or so later that Rob Pike wrote a screen editor. I wonder if it made him feel important? :-)
- akerstenYes, who would have guessed that the <textarea> element, designed specifically for this use case and built into browsers for 3 decades, would be the most performant and behaviorally consistent way to implement editable text.I'm kind of sad the author stopped shedding unneeded complexity there though... we're not really building a text editor yet, we're building a website with a fancy input field. If we want to build a proper text editor we must eschew the bloat that is the web browser too.
- pmarreckThe highlit line and cursor are 1 down from the line it thinks it is editing.I see off-by-one errors are still a common bug class, lolEDIT: It's only in the earlier examples.I'm glad you use pulsating cursors. I made this work in WezTerm but it is expensive CPU-wise!
- pmkaryText editors are like mechanical watches or fountain pens. There is just so much beauty in the machinery that makes them. For me, there are hardly any other modules that are this satisfying to watch being made. Each time I find a new one (a good one like this), with everything on ropes and rendering and I-beam placement computations and ... it feels like a Christmas gift.
- IsofarroThe author travels the same path that ended up eventually with VS Code.Reminds me strongly of Marjin Haverbeke's talk at Full Frontal conf in 2011: https://ffconf.org/talks/respectable-code-editing-in-the-bro... - Using Canvas, then contenteditable, and then DOM.Haverbeke went on to create CodeMirror and ProseMirror.
- holgerschurigFine, I do this since several decades.I use an editor-construction kit named "Emacs" to build my own Editor, and IDE, and git porcelain, and organizer, and wiki. And many things more.IDE with e.g. LSP integration, rustix and many other programmer-related modes and enhancements like tree-sitter. Git porcelain with magit. Organizer with Org-Mode. Wiki with denote.
- fg137When I saw the title, I thought this is about a native editor. A noble pursuit.As I read on I realized this is about a web based editor. Almost just as noble but I would not wish anyone go down this rabbit hole. You cannot build a good, performant and useful editor without sinking tons of work, as proved by many people. You could create something simple but will very quickly discover all sorts of problems and edge cases with it.
- rf15> Fine, I'll build my own text editor> “They don’t make ’em like Sublime Text anymore” resonated with a lot of folk.My first kneejerk reaction was, no, Sublime wasn't even that good or performant. We also really don't need another garbage baby's first text editor.But then> I’m good at building garbage!I appreciate the sentiment, and I guess that IS the right approach to the problem, don't take it too seriously. And the rest of the writeup describes some fun basic hoops you have to jump through to build something as simple as a text editor, so good job.
- stillpointlabI literally just got Fable to write me a text editor. Well, I'll be honest, I got it to wrap the KDE KTextEditor library which is like 90% of a text editor.I had been using Kate which was what an LLM suggested was the closest to something like Sublime Text on Fedora. But even Kate, which was great, had too much going on.So I asked Fable to take the text editor part (KTextEditor) and wrap it using Rust with an LSP server. It took about 2 days but I have a tiny, super fast little editor. I use Sway to manage things like tabs, fuzzel stands in for fuzzy file search, broot stands in for an explorer view. I've already added Markdown preview support. I might get around to some basic git integration.Then I got it to turn that little editor into a note-taking interface that I have bound to a Mod-m key binding to keep notes in ~/Notes.We live in wild times. I hope everyone is taking advantage while they can.
- dangRecent and related:They don't make 'em like Sublime Text anymore - https://news.ycombinator.com/item?id=49209354 - Aug 2026 (13 comments)
- philipptaI recently learned that Odin has fully-featured text editing primitives in its core library. Coupled with the bundled raylib library, it should be fairly easy to build a GUI text editor from scratch.https://pkg.odin-lang.org/core/text/edit/
- nottorpThere really is a fps counter on there.Is the experiment seriously rendering continuously in a loop?
- kris-memoketYou are truly a very dedicated developer! Thank you so much for your artifacts!
- krzyzanowskimthe Web is probably the most limited platform today to build custom text editor, in terms of text layout, interaction and all the small bits that may matter. It is still lacking proper API to interact with the OS input system outside the browser built-in text capabilities. That's why the <canvas> approach is so painful, and everything else is "limited" by the HMTL and Browser implementation details.
- inopinatusI never stopped using Sublime Text so I suppose I am cool again.
- jstummbillig> [...] is promising but I’ve noticed strange [...]In a nutshell, the perpetual experience of writing your own (web) text editor.
- Jean-PhilipeOT but I really like the design of this website. It's fresh, it's fun, but still easy to read. Love the AI policy page as well.
- alwaysmrnoOh God Not another text editor. I swear that text editors are to computer engineers what trains are to mechanical engineers. Or Satisfactory to Systems Engineers
- vintermannI still miss NEdit.Around 2001 when I started getting into Linux seriously, I was also reading a lot about cults - Scientology had recently, infamously, forced Slashdot to take down a comment about their secret practices.One of the things I read was that a common cult trick was to demand that people re-learn basic skills so that they do them the "right" way, like reading (Scientology did that), eating (chew X times!), using the phone etc.So here's this system that demands I need to learn basic text editing all over? Nope, not joining that cult! We Amiga kids had had graphical editors for a long time!So I got the best modern text editor Linux had at the time, NEdit from fermilab. It was almost entirely CUA + the conventions we use today (which aren't entirely what we used in 2001). And the unusual features it had, such as square selection and X-style middle click copying, were quick to pick up. It was also tiny, both in binary size and memory footprint.Sadly it didn't really survive the switch to utf-8. I switched to Slava Pestov's Jedit for many years, and did some cool things with its huge library of extensions. But when VSCode started doing IDE stuff better than most IDEs, I defected to that. Yes yes, electron, Microsoft, I know... but it's just so damn convenient.
- qbaneHope the author finds CodeMirror 6 to be a solid foundation. It uses the same contenteditable-based approach but abstracts away all the browser-specific edge cases and quirks for you.
- zahlmanOddly enough, I've recently started doing a text editor myself. (I'm using Tkinter, and I am implementing a Vim-like editing system with key commands and modes and such, but substantially different from actual Vim.)
- swiftcoderFor some reason on all the canvas based demos, the text cursor is displayed on the line below where actual text insertion happens (at least on Safari). Canvas-based text editor is definitely hard-mode
- dkerstenInterestingly, for me on iOS, all of the examples worked except the textarea one, which didn’t allow me to interact at all.
- joefreeman> I’m good at building garbage!I've also been building my own editor - it's been fun. In my case it's a modal editor, so I ended up rendering with <div>s, but using a <textarea> to capture from the clipboard.https://github.com/joefreeman/aether
- rfgplkThe single most disappointing fact about (more or less) all text editors on the market today is how god awful their performance is. For most text editors, and when I say most I really do mean _most_, you can very easily start seeing noticeable lag and stuttering when making modifications, or even outright INPUT LAG when entering text. For very tiny buffers <1kB it's a rare occurrence (although bad editors lag there too), but once you start crossing the 10kB size it's dead obvious. For editing buffers >1MB, 99% of them are unusable due to a) writes taking SECONDS (how?) b) scrolling/using the buffer physically lagging out the editor itself. Which is really basic functionality that editors should be able to handle since it's rather trivial to come across a multiMB json/config file. Try a simple benchmark cd /tmp && dd if=/dev/random of=big_file bs=4096 count=10000 [editor of choice big_file] This should really be _trivial_ for any modern CPU.
- DriftbenchBeen there, done that. It's a rabbit hole, but you learn so much about rendering and input. Good luck!
- anonundefined
- dvhI've been using my own text editor for over decade. Written in Lazarus using SynEdit component. It's trivial.
- SweeplineAll I wanted was proper multi-cursor editing and Emacs keybindings. Gave up and just started a new `src` folder.
- anon291I am being pushed to use vs code right now by my team, but we already have a fully programmable and scriptable editor called emacs that is 100000x better. I don't understand why everyone just switches to these random tools. Text editing is a solved problem. Most of the supposed advantages of these tools is just a configuration of vim or emacs.
- samusEvery time someone has that idea they discover that text editing is hard! Kudos to the author that they considered accessibility as well.
- EdZitron2He used AI but his site says “No AI”
- throwawayffffasOoof you were not lying about the garbage. Hidden div for scrolling on canvas...Not really judging I make a lot garbage too.If you are going to do custom drawing why bother with the web platform, go native.
- pizzabearmanVim bindings joke was great
- erichoceanIf you want to do this in Clojure, Clobber[0] is a great base to start from.It can be used in headless-mode, I've hooked it up to the latest JavaFX text editing component it works very nicely.[0] https://github.com/phronmophobic/clobber
- globalnodeThe problem with writing an editor if you intend to use it for coding, is not the text editor itself, that's rather simple. The problem is code completion and syntax highlighting. Then whatever system you try to implement becomes just as bloated as the bloatware you're trying to replace.
- syngrog66A mini-vi/vim I might be willing to reinvent for myself, if I ever felt it was needed or a net win. but would (obviously) prefer not. free time & energy are precious
- lynx97So apparently every half-serious coder will write at least one chess engine and a text editor. Any other program type which gets implemented over-and-over again?
- self_awarenessText editing is a solved problem.It's not about the style of cursor, or if rope is used or not. We already have answers to that.It's about remote editing, LSP support.
- jdw64There used to be a joke that said, 'A great programmer should try building a text editor.'
- pacMakaveli[flagged]
- tom_wang007[flagged]