Skip to content

Conversation

@Sylvain78
Copy link

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.

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.
@humdingerb
Copy link
Member

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...

@Sylvain78
Copy link
Author

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.

@korli
Copy link
Contributor

korli commented Jul 21, 2025

Did you try to disable writebackups in vim?

@humdingerb
Copy link
Member

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.

@Sylvain78
Copy link
Author

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.

@humdingerb
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants