Notepad++ File Status Auto-Detection not working
VS2015 build with /Zc:threadSafeInit- at https://ci.appveyor.com/project/chcg/notepad-plus-plus/build/1.0.118
Claudia Frank last edited by
thx, will do the test and report the status later (2-3 hours).
Claudia Frank last edited by
sorry but additional compiler flag does not work either.
Looks like time to use additional logging then. I mean, logging around file status detection. (I briefly looked at the code, and it’s not obvious at the first glance what exactly can go wrong.)
I’ve found out the cause of the problem. In VS2015, the stupids from Microsoft have broken _wstat for Windows XP! According to a simple change inside the file “PowerEditor\src\ScitillaComponent\Buffer.cpp”:
int st = generic_stat(_fullPathName.c_str(), &buf); char s; sprintf(s, "Buffer::checkFileState() -> %d, errno %d, FileName \"%S\"", st, errno, _fullPathName.c_str()); writeLog(_T("1.txt"), s);
one can notice that _wstat always returns -1 under Windows XP with errno 22 (EINVAL).
So the fix seems to be to replace _wstat with some native WinAPI function, since we can not rely on VS2015’s CRT anymore.
See https://github.com/joncampbell123/dosbox-x/issues/403 and https://github.com/joncampbell123/dosbox-x/issues/438 which also suffers from this issue. From https://stackoverflow.com/questions/6566978/whats-the-difference-between-struct-stat64-and-struct-stati64-on-win32, maybe we are facing a 64bit issue, see https://msdn.microsoft.com/en-US/library/14h5k7ff.aspx. What happens on using _wstat64.
Yes, it could be that _USE_32BIT_TIME_T needs to be defined for Windows XP. On the other hand, it was reported that defining _USE_32BIT_TIME_T, in its turn, creates problems with std::chrono… Just madness.
_wstatis used there just to get the file modification time and check if it is read-only or not. There are 2 corresponding WinAPI functions that can be used instead, without being relying on
GetFileAttributes. Using them, any further breaking change in
_wstatwill not affect Notepad++ at all!
As far as I understand, an honour to implement the proposed change is mine :) As Notepad++ is the base for all its plugins, I consider such task as quite important. I don’t promise I do it quickly, but I already have an idea what exactly to do. Since _wstat is already called through a macro, the most straightforward change will be to call own function instead of _wstat via the very same macro, providing own structure returned by the function, and the structure will be filled by the WinAPI functions. So the code will remain similar at the surface, but will not rely on _wstat anymore.
OK, guys, I want to make everything in the proper way :) Do you usually create a new git branch to use it for the pull request? Or just directly modify the “master” branch? And is there any possible hints/problems regarding authorization (such as special write rights, SSH, etc.)?
See https://github.com/notepad-plus-plus/notepad-plus-plus/pulls e.g.
https://github.com/notepad-plus-plus/notepad-plus-plus/pull/4172 made from branch cmeriaux:fix_shortcut_validity. So branching your forked master is the better way, so you could easily pull upstream master again for future work. See also https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/CONTRIBUTING.md. There shouldn’t be problems regarding auth against your github fork.
Maybe check this one https://gist.github.com/Chaser324/ce0505fbed06b947d962 regarding git usage with github.
Probably I’m doing something wrong, but here is what I’m getting currently:
git.exe push --progress "origin" feature/file-status-detection-winxp remote: Permission to notepad-plus-plus/notepad-plus-plus.git denied to d0vgan. fatal: unable to access 'https://github.com/notepad-plus-plus/notepad-plus-plus.git/': The requested URL returned error: 403
You can’t push to the repo of donho at https://github.com/notepad-plus-plus/notepad-plus-plus. Do you have a fork of it? Something like https://github.com/chcg/notepad-plus-plus?
That must be it! I did not fork it indeed, just created a branch directly from the https://github.com/notepad-plus-plus/notepad-plus-plus. Will do the fork, thanks.
You know, I realized I absolutely hate the f*ckin’ git, just completely and absolutely.
I’ve created https://github.com/d0vgan/notepad-plus-plus/tree/feature/file-status-detection-winxp and I followed hell of instructions to synchronize it with the main (non-forked) repository. Currently I’m having:
git remote -v origin https://github.com/d0vgan/notepad-plus-plus.git (fetch) origin https://github.com/d0vgan/notepad-plus-plus.git (push) upstream https://github.com/notepad-plus-plus/notepad-plus-plus.git (fetch) upstream https://github.com/notepad-plus-plus/notepad-plus-plus.git (push)
And I already tried commands such as (I’m listing them here one by one, but actually I tried them in different order according to what I found in internet):
git fetch upstream git merge upstream/master git rebase upstream/master git rebase master
but still an attempt to create a pull request shows much more changes than I actually made.
I just don’t have any idea what else I need to do to overfight this git madness. It just drives me out of my wits.
Vitaliy Dovgan last edited by Vitaliy Dovgan
OK, I’ve created https://github.com/notepad-plus-plus/notepad-plus-plus/pull/4226
I have no idea idea why git shows changes in the functions isCertificateValidated and isAssoCommandExisting - I did not touch them at all! If I knew how to get rid of those “changes”, I would do it already.
ggo98 last edited by
Still have the same issue on some machines (file change not detected).
In my case, it’s on Win 8.1 with NPP 7.9.5 (same with 7.9.1 and previous versions)…
Any solution since 2018 please?
PeterJones last edited by PeterJones
If you have an exact sequence of events that doesn’t work as expected, which others can replicate, then share it here, and we can try to confirm; if we agree that there’s a problem, then you can follow the FAQ to make a bug report. But all you have is a vague assertion that something “doesn’t work”. I’ve never yet seen a version of Notepad++ that doesn’t report to me when an external process has changed my file in my workflows. So, with the lack of detail you’ve provided, the best I can say is “it works for me”.
For example, a repeatable sequence:
- create a file named
opened.txtin Notepad++, with the text
This is opened., and save into a known folder
- right click on the tab bar, and select Open Containing Folder in cmd (or File > Open Containing Folder > cmd)
- from the cmd prompt,
echo appended >> opened.txt
- click on Notepad++: it will say,
- when I say Yes, the file reloads and now shows
This is opened.appended.
That says Notepad++ noticed the change in the file.
- Turn on Monitoring mode (either the eyeball on the toolbar, or View > Monitoring (tail -f)
- Do a few instances of
time /t >> opened.txtfrom the cmd window
- the Notepad++ editor shows the updated file with a few timestamps
?-menu > Debug Info
Notepad++ v7.9.5 (64-bit) Build time : Mar 21 2021 - 02:13:17 Path : C:\usr\local\apps\npp\npp.7.9.5.portable.x64\notepad++.exe Admin mode : OFF Local Conf mode : ON OS Name : Windows 10 Home (64-bit) OS Version : 2004 OS Build : 19041.867 Current ANSI codepage : 1252 Plugins : mimeTools.dll NppConverter.dll NppExport.dll
The settings in Settings > Preferences > MISC > File Status Auto-detection may also influence your results. During my above experiments, mine were set to
So again, I say, “it works for me”.
- create a file named
David Brigden52 last edited by
I backed into this issue the other day and and can replicate. It’s related to the NotePad++ split view. I see this in 7.9.5 and saw in 7.9.3 though I assume this is older.
Notepad++ v7.9.5 (32-bit)
Build time : Mar 21 2021 - 02:09:07
Path : C:\Program Files (x86)\Notepad++\notepad++.exe
Admin mode : OFF
Local Conf mode : OFF
OS Name : Windows 10 Enterprise (64-bit)
OS Version : 2004
OS Build : 19041.804
Current ANSI codepage : 1252
Plugins : none
Here’s how I can repeat.
- open/create 2 files call them view1 and view2 and save
- move one to other view.
- click on view1 so that N++ is focused there
- open a command prompt and edit view2. (I used copy con)
- click on the Notepad ++ title bar
- N++ is focused on view1.
- click on view2. no warning of file status change.
- Click on the command window and then back to view2 and the message appears.
If you change step 5 to click on the edit window for view1, you don’t get the warning. If you change step 5 to click on view2, you DO get the warning. Similarly, if you are in view2 when you go to the command prompt, what happens is also changed.
- Click on the N++ title bar and the warning will appear.
- Click on view2 and the warning will appear
- Click on view1 and the warning will not appear