-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error displaying text when files are automatically updated #686
Comments
It just load the file content, if the file is saved in another process, Notepad2 should reload it again with the updated content. |
Yes, Notepad2 just loads the file, and the real content of the file is:
But reloading it will not show the few characters on the front end, which becomes this:
If the text is modified at this point, the currently displayed characters will overwrite the real file, and thus the file becomes:
This is a long-standing bug. But since Notepad2 is not my main editor, I just use it for a quick look at the text. But when I started using it more often and configured the formatting tool (which formats files from the background), the problem became serious and many files were corrupted. |
Looks like subsequent changes not detected (file not reloaded), please check "Detect file change by polling instead of notification" on "File Change Notification" dialog (we may need a better description for the option). |
This is what happens when the "Detect file change by polling instead of notification" option is enabled. |
Oh, what happens after turn off it? |
It's the same when it's closed. |
By the way, the same formatting tool (modifying the file in the background), the same file (test.ahk), both EmEditor and vs code were able to display the changed file immediately and correctly. |
Hi @DeepTulip, can you share how to setup your background formatting tool? I can try to reproduce the problem. |
Use AutoHotkey.exe to load this code:
|
It works on second run without |
Fixed by e632ff2 ( |
This is just as I suspected. Thank you very much. |
When a file is modified by another process, notepad2 automatically updates the contents, which can lose the first few characters. If you edit the text at this point, these characters will be completely lost.
↓↓↓
WIN 10 64
FILE UTF-8
Notepad2 (64-bit) 4.23.06 r4862 (d53367e)
Compiled on Jun 18 2023 with Visual C++ 19.36.32534.0,
Scintilla 5.3.5.
Encoding: UTF-8 BOM, GBK
Scheme: .ahk, AutoHotkey Script
System: 10.0.19045 x64
The text was updated successfully, but these errors were encountered: