Re:NotepadNext: A cross-platform reimplementation of Notepad++
by dataflow on Friday April 08, 2022 @05:00PM
(#30962450)
I think every platform supports FS notifications at least right? The app could listen for changes to the file and reload/discard when it goes out of sync. In fact Notepad++ already does this.
On Windows in particular you also have a ton of other facilities that could help with this (opportunistic locks, transactions, etc.) but notification is usually good enough.
Re:NotepadNext: A cross-platform reimplementation of Notepad++
by chongli on Friday April 08, 2022 @05:19PM
(#30962636)
My main editor is vim. It notifies the user when a file you have open in a buffer gets modified on disk by another process. It explicitly gives you the option to load the file from disk at this time. I would not use a text editor which silently reloads a file because this could result in a loss of work.
Re:NotepadNext: A cross-platform reimplementation of Notepad++
by dataflow on Friday April 08, 2022 @05:22PM
(#30962660)
Yeah Notepad++ asks you too. I don't know of any editors that silently discard changes by default.
Re:NotepadNext: A cross-platform reimplementation of Notepad++
by workerdrone451 on Friday April 08, 2022 @06:41PM
(#30963380)
While many editors will come and go, vi in some form will always remain. Once you "get" it, using anything else starts to become alien.
Re:NotepadNext: A cross-platform reimplementation of Notepad++
by bccdee on Saturday April 09, 2022 @12:23AM
(#30965258)
Not necessarily. It's possible to listen for file updates and respond accordingly on the fly by re-reading the file and updating all your offsets and mmaps. It doesn't even have to be efficient; it's not a common case.
Re:NotepadNext: A cross-platform reimplementation of Notepad++
by phendrenad2 on Friday April 08, 2022 @06:18PM
(#30963192)
This would also be too slow. The user may want to jump from line 1 to line 999999. You can't do a file load fast enough.
Re:NotepadNext: A cross-platform reimplementation of Notepad++
by Semaphor on Saturday April 09, 2022 @12:27AM
(#30965269)
> This would also be too slow. The user may want to jump from line 1 to line 999999. You can't do a file load fast enough.
My text editor supports files up to 256 GB in size, unless you have that much memory, you’ll have to wait a little bit to go from the first to the last line.
Re:NotepadNext: A cross-platform reimplementation of Notepad++
by andai on Saturday April 09, 2022 @10:42AM
(#30968452)
That's great, which editor is that?
Re:NotepadNext: A cross-platform reimplementation of Notepad++
by erwincoumans on Saturday April 09, 2022 @10:55AM
(#30968549)
I use UltraEdit, it opens files way beyond hundreds of GB without issues, both text and binary (in hex edit mode). Love that editor for over 10 years (perpetual license) on Windows, Mac and Linux. See the video loading a 35GB text file: https://www.ultraedit.com/support/tutorials-power-tips/ultra...
Re:NotepadNext: A cross-platform reimplementation of Notepad++
by Semaphor on Saturday April 09, 2022 @12:58PM
(#30969684)
EmEditor, it’s windows only: https://www.emeditor.com/
Re:NotepadNext: A cross-platform reimplementation of Notepad++
by erwincoumans on Saturday April 09, 2022 @08:10AM
(#30967336)
Isn't that what having offsets and mmaps are for? With that information, jumping lines becomes constant time.
Except that this would most likely result in unpredictable corruption if another process modified the file while you had it open, which is contrary to the way basically every text editor works.
It would be nice if there was a way to mmap a file in such a way that the OS would give you a snapshot view, but AFAIK that doesn't exist, at least on Linux in a filesystem-agnostic way (not sure about other operating systems).