v9 Usually doesn't reload modified file after running external tool

General questions about using TextPad

Moderators: AmigoJack, helios, bbadmin, Bob Hansen, MudGuard

Post Reply
rcourtois
Posts: 9
Joined: Tue May 13, 2003 7:47 pm

v9 Usually doesn't reload modified file after running external tool

Post by rcourtois »

I'm running version 9.3.1, but I believe this has been happening with earlier 9.x versions also. I have a code formatter set up as an external tool which will rewrite the current file when it is called. Usually when this is run, TextPad doesn't reload the file automatically. In prior versions of TextPAd it did reload the modified file every time. I have the files modified settings set to auto-reload, to not ignore differences in modified times less than 2 seconds, and to check for file size changes. After running the formatter, if I shift-tab to another file and back, then it will reload. If I forget to do that and start making additional changes, when I go to save or run the formatter again, I'll get the save as dialog.
User avatar
AmigoJack
Posts: 482
Joined: Sun Oct 30, 2016 4:28 pm
Location: グリーン ヒル ゾーン
Contact:

Re: v9 Usually doesn't reload modified file after running external tool

Post by AmigoJack »

rcourtois wrote: Thu Dec 07, 2023 1:28 pmwhich will rewrite the current file
Are you sure? Because deleting an existing file and then creating a new one with the same name is different from rewriting an existing file. Check the creation date/time of the file or adjust the access permission on the folder to refuse file creation for a test.

However, I cannot recall TextPad checking for file modifications as long as TextPad and that document has the input focus - you'd have to at least loose focus to another window, or to another document within TextPad. When this ever worked for you, the tool being ran might have claimed input focus for itself (the duration doesn't matter, so you might not have even noticed that a new window was created and closed, so TextPad shortly lost its focus but got it back milliseconds later).
rcourtois
Posts: 9
Joined: Tue May 13, 2003 7:47 pm

Re: v9 Usually doesn't reload modified file after running external tool

Post by rcourtois »

I confirmed that the create time of the file doesn't change when the formatter runs, only the modification time changes. In doing some more testing, I did find that if I save the file first, wait a few seconds, then run the formatter, it will reload every time. The formatter does open its own window, so TextPad does lose the focus while it runs.

One thing to note: The parameter "Ignore differences in modification times less than 2 seconds" does not seem to make a difference. Whether that box is checked or not, the file usually doesn't reload automatically if it's in a modified state when I run the formatter tool using its keyboard shortcut in TextPad. This also happens in TextPad version 9.4.0. Calling the formatter from a script and adding a short delay after it runs does allow the file to reload every time, so I'll do that for now.
Post Reply