leafpad icon indicating copy to clipboard operation
leafpad copied to clipboard

Feature request: File changed on disk detection

Open Tirus42 opened this issue 2 years ago • 2 comments

It would be great if leafpad could inform the user, when the opened file changed on disk and leafpad has the previous state open.

This can avoid data loss when working inside a shared folder.

A very simple way to achieve this is to check the opened file for the modified data every time the leafpad window receives the input focus.

A simple popup message would be enough to inform the user or even allow to select, if the file should be reopened (and all local modifications will be lost) or just to ignore this change (and possibly override with the next save action).

Tirus42 avatar May 28 '22 08:05 Tirus42

A very simple way to achieve this is to check the opened file for the modified data every time the leafpad window receives the input focus.

Checking the file modification date on disk vs. last read/write date inside the program is probably the simplest solution, though a bit unreliable. On Linux, I think using inotify will be the best option, as it flips the flow around - instead of polling the filesystem and checking for changes, it's the OS notifying the program about changes.

suve avatar Jan 27 '24 10:01 suve

Please pull request. However inotify depends on Linux, so it is preferable to support it with glib.

tarot231 avatar Jan 27 '24 12:01 tarot231