News for hackers. Stuff that matters.
Re:NotepadNext: A cross-platform reimplementation of Notepad++ by Taywee on Friday April 08, 2022 @04:08PM (#30961929)
Because then all your edits have to go directly into the file, so you have no real "save" flow unless you make a swap file for every file and then mmap that (which can be an appropriate approach, to a degree). Then all your caching and memory use subject to OS I/O and filesystem concerns, and you can't optimize for specific use. And inserting or deleting the middle of the file means shifting all the bytes after it.

I could think of a reasonable implementation for Linux that would use mmap and fallocate, but it wouldn't "just" be an mmap, as the swap file would still need to represent a rope or a gap buffer or something else of the sort for efficient editing.

Re:NotepadNext: A cross-platform reimplementation of Notepad++ by jhgb on Friday April 08, 2022 @04:30PM (#30962157)
Aren't edits of a huge file expected to be comparatively small? If you're editing an mmap'd file, I'd expect the editor to maintain a display combining the original mmap'd file with a list of changes that have been performed so far.