News for hackers. Stuff that matters.
Re:The ancient world before computers had stacks or heaps by masfuerte on Wednesday April 03, 2024 @04:32PM (#39922706)
Some word processors on 8-bit computers worked like this. Your document took all of the available RAM. Text before the cursor was at the start of RAM and text after the cursor was at the end of RAM. Insertions and pastes didn't need to shuffle data around but navigation did. It worked well.
Re:The ancient world before computers had stacks or heaps by shadowgovt on Wednesday April 03, 2024 @04:39PM (#39922791)
emacs still does this IIUC. The beating heart of the emacs edit model is a "gap buffer" at the cursor.

There's a neat compare-and-contrast someone did awhile back on the gap buffer approach vs. the other approach often taken for code IDEs ("ropes"). The tl;dr is that gap buffers are actually really performant for a lot of cases except for having to edit at a lot of randomly-chosen cursor points far apart from each other (but how often is that your use case?).

https://coredumped.dev/2023/08/09/text-showdown-gap-buffers-...

Re:The ancient world before computers had stacks or heaps by cerved on Wednesday April 03, 2024 @06:18PM (#39923982)
seems like Vim does too
Re:The ancient world before computers had stacks or heaps by derefr on Wednesday April 03, 2024 @09:41PM (#39925630)
> except for having to edit at a lot of randomly-chosen cursor points far apart from each other (but how often is that your use case?)

I use Sublime, and pretty often I do a "Find All" for some term; then Multiselect (Cmd+L); then select from cursor (Shift+RightArrow); and then type something. Which is essentially "editing at a lot of randomly [or at least arbitrarily]-chosen cursor points."

That, and IIRC Sublime actually does its "Find and Replace All" operation, as essentially this same multicursor-select-and-type operation internally. (If you have a large-enough buffer open, you can see it gradually doing it!)

Re:The ancient world before computers had stacks or heaps by shadowgovt on Thursday April 04, 2024 @12:58AM (#39926701)
I've never been able to make that work, but I respect that you have. Generally, that kind of select almost always grabs a bunch of substrings that aren't appropriate and I end up mangling my file.
Re:The ancient world before computers had stacks or heaps by User23 on Thursday April 04, 2024 @01:27PM (#39933406)
I’ve never noticed any perceptible latency using iedit[1] in Emacs, which does what it sounds to me like you are describing.

It does suggest a possible multigap buffer structure though for efficiently doing simultaneous edits of distant locations in very large files. In that case though I’d probably be iediting a small wgrep[2] buffer anyhow so it might not really matter.

[1] https://github.com/victorhge/iedit

[2] https://github.com/mhayashi1120/Emacs-wgrep

Re:The ancient world before computers had stacks or heaps by RexM on Thursday April 04, 2024 @10:37PM (#39938154)
I do the same thing in sublime. Doing it still feels like I have super powers even after years of doing it.

I’m sure there’s some magic key combo in emacs and/or vim to do it, too.