14 ms·
The Craft of Text Editing (1999)
- Todd 10y agoA paper that covers some of the data structures used in editors is: https://www.cs.unm.edu/~crowley/papers/sds.pdf https://www.cs.unm.edu/~crowley/papers/sds.pdf The gap buffer, in particular, is a great example of a simple yet powerful idea that is perfectly suited to the problem domain.
- polm23 10y agoThe text in that PDF didn't show up correctly for me, but there's an HTML version of the paper here: https://www.cs.unm.edu/~crowley/papers/sds/sds.html https://www.cs.unm.edu/~crowley/papers/sds/sds.html
- bernardlunn 10y agoWas irony intended?
- jwhitlark 10y agoI liked it so much I bought a hard copy a couple years ago. Lots to learn in that book.
- cmyr 10y agoI've been learning a lot lately by following along with the development of xi[1], a new text editor written in Rust. Through reading that project's RFCs I've then come across other interesting projects, like swiobe[2] and wi[3]. What are the other canonical resources on this topic? It feels like tons of the interesting thought is scattered around various blogs and usenet posts and the like. I'd love to create a nice collection of good writing on text-editing / tools, but I'm not sure where to start. [1] https://github.com/google/xi-editor https://github.com/google/xi-editor [2] https://github.com/swiboe/swiboe https://github.com/swiboe/swiboe [3] https://github.com/wi-ed/wi https://github.com/wi-ed/wi
- gwright 10y agoSam comes to mind as an interesting project in this area: http://doc.cat-v.org/plan_9/4th_edition/papers/sam/ http://doc.cat-v.org/plan_9/4th_edition/papers/sam/
- 0x445442 10y agoToo reliant on the mouse.
- jasonm23 10y agoREmacs is a very interesting development... https://github.com/Wilfred/remacs/blob/master/README.md https://github.com/Wilfred/remacs/blob/master/README.md
- nextos 10y agoIt'd be amazing if it crystallizes in a few years. Improving the old parts of Emacs, especially GUI code and low level things is a must. Rust seems like an ideal replacement for C. Great performance, much better safety guarantees. Equally important is perhaps improving elisp concurrency. The jury is still out on whether this will happen by migrating to Guile Scheme [1]. [1] https://www.reddit.com/r/emacs/comments/4zttlt/guileemacs_status/ https://www.reddit.com/r/emacs/comments/4zttlt/guileemacs_st...
- dws 10y agoFun blast from the past. The original version of this shipped with Mark of the Unicorn's Mince/Scribble package for CP/M. (Mince = Mince Is Not Complete Emacs)
- ScottBurson 10y agoGlad to see someone remembers that! (I was a cofounder.) The sources for the original version of Mince were lost long ago. It's too bad; they were very clear (thanks to the skills of Jason Linhart, the primary author, as well as Craig) and would have made a great example for study.
- kabdib 10y agoI used MINCE quite a bit, and it was great. MINCE was what you used for Emacs if you couldn't get to an ITS machine :-) Thanks, it was a really nice editor.
- mrsharmaa123 10y agofacbook hack
- erikb 10y ago> In its most general form, text editing is the process of taking some input, changing it, and producing some output. Funny how similar that definition is to the "programming" one.
- fmoralesc 10y agoThat's because that is just what a Turing machine does.
- ashread123 10y agoThe future of the internets world is in hackers hands. Hackers are exposed to you by texting 19193076946 for more details on how you can get a real hacker to work for you
- AlexanderDhoore 10y agoI once build a text editor using a rope[1] data structure where every line was a node. The tree was augmented[2] with information about line numbers, titles in the document... for very fast navigation. I don't think primitive data structures like a gap buffer are useful anymore. They come from a time where saving on memory was more important than it is now. EDIT: I forgot it was also a self balancing tree! Very cool stuff. [1] https://en.wikipedia.org/wiki/Rope_(data_structure) https://en.wikipedia.org/wiki/Rope_(data_structure) [2] https://en.wikipedia.org/wiki/Interval_tree#Augmented_tree https://en.wikipedia.org/wiki/Interval_tree#Augmented_tree
- teddyh 10y ago> I don't think primitive data structures like a gap buffer are useful anymore. They come from a time where saving on memory was more important than it is now. I beg to differ. I routinely open multi-gigabyte log files and SQL dumps in text format, and would not like to have to resort to “sed” to edit them.
- AlexanderDhoore 10y agoI don't disagree. Although a good rope implementation can handle that. Ropes are nice because it doesn't matter where you edit. Gap buffers have to copy around a lot of data if you are editing in different places. Btw the memory overhead is not that much. It's just the memory needed to keep the pointers between the nodes. So I'm talking 10% increase or something.
- geocar 10y agoA dissent: Saving memory isn't strictly orthogonal to editing performance. A paged gap buffer (as described with an array index) remains ideal when you need to make a small number of surgical changes (insertions, deletions, etc) to a very large file, especially given the fact that all modern systems have page mapping hardware, so anything you implement is effectively on top of a paged gap buffer anyway. What we're really searching for is a better program-visible structure. To that end, the biggest difficulties in efficient text editor, is that most text editing is (ahem) textbook, and neglects the fact that fork() copies on write making most real operations asynchronous, and combining writev() and mmap() can be used to produce whatever memory layout you want (a plain old stupid byte array if that's convenient); The kernel will memcpy your page table for you, so there's no sense in also doing it in user-space. And so on. If you consider at which point a write() and a mmap() (or on OSX a mach_vm_remap()) will be faster, just how much faster it will be -- imagine: programming something as simple as a plain byte array but with instant inserts (memmove) across multi-gigabyte buffers. Then consider the cost of a write()+mmap() syscall combination in the worst case (a couple hundred micros?) and you'll never use a complicated (linked list) data structure again.
- gf263 10y agoI never understood why these webpages can't have like, 4 lines of CSS to make them much more readable. Preserve the older aesthetic I guess?
- daveguy 10y agoWhat 4 lines would those be?
- axiomabsolute 10y agoInspired by https://bestmotherfucking.website/ https://bestmotherfucking.website/ body { margin: 1em auto; max-width: 40em; font: 1.2em/1.62em sans-serif; } That seems like a good start
- daveguy 10y agoNice! Thank you!
- moron4hire 10y agoLooks great on my phone. Symantic HTML is responsive by default.
- axiomabsolute 10y agoIt's a bit awkward to read on large screens. Long lines and whatnot
- throwanem 10y agoBut, in demonstration of another virtue inherent in this sort of simplicity, reader mode handles it beautifully.
- zeveb 10y ago> It's a bit awkward to read on large screens. Long lines and whatnot For years and years and years I always had a half-screen-width browser window, precisely because it's easier to read text that way. But then site authors started assuming that I'd have a full-width window, and using CSS to waste half the window width. I still think that the correct response to 'window too wide' is 'shrink the window,' but it's a losing battle.
- z3t4 10y agoAs someone currently working on a code editor I love this stuff, but there's usually more focus on the technical part then the human part. With todays hardware we can do millions of stupid things every second and it will still feel snappy. We should spend more time trying to optimize for the humans instead of their computer.