The fact that all (and not only the active one) changed documents are reloaded when the NP++ window gets focus annoys me quite a bit. It throws me out of context, i.e. the active file is not the one I was editing before the sequence of "Document changed. Do you want to reload it?" messages. There is a bug report about this (#1401: https://sourceforge.net/p/notepad-plus/bugs/1401/) and an idea on the idea torrent (Reload file only when it becomes active), but still nothing has changed.
I'd like to try to correct this myself. The first step is to locate the code that does it. Is this the correct location: File Buffer.cpp, function FileManager::checkFilesystemChanges()? There, all open buffers are checked (and not only the active one).
I'm very surprised that NP++, an otherwise excellent program, has such an inconvenient (IMO) behaviour.
Note that it is related to idea https://sourceforge.net/apps/ideatorrent/notepad-plus/ideatorrent/idea/259/ to check modification on tab switching, and it was in my list of things to do eventually...
What initiates the process of checking if files are modified is in NppBigSwitch.cpp, in case WM_ACTIVATEAPP, where checkModifiedDocument() is called. It then calls checkFilesystemChanges() which loops through all buffers (open files) to call checkFileState(). So you will probably want to checkFileState on WM_ACTIVATEAPP, but only for currently active buffers (the two views), and also on NPPM_ACTIVATEDOC.
Thank you for the comment! Indeed, the idea you pointed to is about the same. But it sees the problem from a little bit other perspective. My main problem is context switching.
A small and quick solution would be to set the focus to the document that was being edited at the moment of "WM_ACTIVATEAPP" (after checking of file changes).
But to check for the changes on tab focus would be even better.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.