mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-06 13:34:44 +02:00
Fix monitoring large file with frequent writes freezes UI issue
Fix #9661, close #15598
This commit is contained in:
parent
624e315686
commit
d5ec03a464
@ -79,6 +79,7 @@ DWORD WINAPI Notepad_plus::monitorFileOnChange(void * params)
|
|||||||
case WAIT_OBJECT_0 + 1:
|
case WAIT_OBJECT_0 + 1:
|
||||||
// We've received a notification in the queue.
|
// We've received a notification in the queue.
|
||||||
{
|
{
|
||||||
|
bool bDoneOnce = false;
|
||||||
DWORD dwAction = 0;
|
DWORD dwAction = 0;
|
||||||
wstring fn;
|
wstring fn;
|
||||||
// Process all available changes, ignore User actions
|
// Process all available changes, ignore User actions
|
||||||
@ -92,8 +93,13 @@ DWORD WINAPI Notepad_plus::monitorFileOnChange(void * params)
|
|||||||
if (wcscmp(fullFileName, fn.c_str()) == 0)
|
if (wcscmp(fullFileName, fn.c_str()) == 0)
|
||||||
{
|
{
|
||||||
if (dwAction == FILE_ACTION_MODIFIED)
|
if (dwAction == FILE_ACTION_MODIFIED)
|
||||||
|
{
|
||||||
|
if (!bDoneOnce)
|
||||||
{
|
{
|
||||||
::PostMessage(h, NPPM_INTERNAL_RELOADSCROLLTOEND, reinterpret_cast<WPARAM>(buf), 0);
|
::PostMessage(h, NPPM_INTERNAL_RELOADSCROLLTOEND, reinterpret_cast<WPARAM>(buf), 0);
|
||||||
|
bDoneOnce = true;
|
||||||
|
Sleep(250); // Limit refresh rate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ((dwAction == FILE_ACTION_REMOVED) || (dwAction == FILE_ACTION_RENAMED_OLD_NAME))
|
else if ((dwAction == FILE_ACTION_REMOVED) || (dwAction == FILE_ACTION_RENAMED_OLD_NAME))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user