BePDF icon indicating copy to clipboard operation
BePDF copied to clipboard

Autoreload (watch on path)

Open Sylvain78 opened this issue 5 months ago • 6 comments

Watch on path instead of node (except when storing attributes)

rationale : when vim modifies a file it creates a new file then rename it. So inode moves, and watching old inode doesn't detect the change.

Sylvain78 avatar Jul 17 '25 20:07 Sylvain78

Just for my information, how is this feature supposed to work? Before your patch and with it applied, BePDF doesn't auto-reload if I rename a file after it was opened with BePDF. Also manually reloading fails.

Hmm, moving the file leads to some flickering of the document in BePDF, so perhaps it is indeed auto-reloaded. But the window title and BePDF's "File info" doesn't show the changed path or file name...

humdingerb avatar Jul 18 '25 15:07 humdingerb

Just for my information, how is this feature supposed to work? Before your patch and with it applied, BePDF doesn't auto-reload if I rename a file after it was opened with BePDF. Also manually reloading fails.

Hmm, moving the file leads to some flickering of the document in BePDF, so perhaps it is indeed auto-reloaded. But the window title and BePDF's "File info" doesn't show the changed path or file name...

Before my patch : autoreload was not done because of an infinite loop (that's what the comment said in the code). Old behaviour was to watch on inode's attributes change, but BePDF changes attributes at load so the inifinte loop arises. And if the file is copied to a new inode, this was not detected (that's what vim does at save).

New behaviour : watches on attributes changes on path name (using BPathMonitor), and deactivates the watching when BePDF changes the attributes at load , reactivates the watch just after if loading is ok. The flickering is due to many attributes change (that's what vim does at save). Annoying but at least the vim save triggers an autoreload.

For the renaming of moving, i don't know what is the the good semantics to apply, I thought the watching did not trigger cause autoreload is trigger only on old full pathmane. Weird you got flickering anyway.

For the Window Title/File Info not updated, I was not aware, i will check.

Sylvain78 avatar Jul 21 '25 10:07 Sylvain78

Did you try to disable writebackups in vim?

korli avatar Jul 21 '25 11:07 korli

BTW, is auto-reload actually desirable? Text editors (StyledEdit, Koder, Pe, Genio) at least give the user the chance not to reload by popping up an alert.

humdingerb avatar Jul 23 '25 14:07 humdingerb

BTW, is auto-reload actually desirable? Text editors (StyledEdit, Koder, Pe, Genio) at least give the user the chance not to reload by popping up an alert.

Sure, but BePDF is not an editor (except for notes) but a viewer. My use is case is to generate the PDF by BeTeX (one click in the latex->dvi icon and one click on the dvi->pdf icon) to see the result automatically in BePDF.

Sylvain78 avatar Jul 29 '25 20:07 Sylvain78

Sure, but BePDF is not an editor (except for notes) but a viewer.

I think there's currently an issue with saving comments etc., but assuming those fixed some day, wouldn't it be rude to have all comments/highlights/user-bookmarks/etc. silently lost when a document gets auto-reloaded? An alert would give the user the chance to cancel the reload and save the document. The "Reload" button should be the default, so a quick "Return" would trigger the reload. Maybe only pop up the alert if the user made any comments/highlights/user-bookmarks/etc.; only save the current position (page). Probably as useful when the user chooses "Reload" manually.

humdingerb avatar Jul 30 '25 12:07 humdingerb