From f4cf622d5acdc88f7ebd35afaafbaf137b0b46db Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Sat, 28 Apr 2018 12:04:55 +0200 Subject: [PATCH] + rev: reverting delayed WaitCursor() call - now depending on some document statistics to prevent displaying "spinning circle" --- scintilla/Scintilla.vcxproj | 1 + scintilla/Scintilla.vcxproj.filters | 3 +++ src/Edit.c | 19 +++++++++++-------- src/Notepad3.c | 10 +++++----- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/scintilla/Scintilla.vcxproj b/scintilla/Scintilla.vcxproj index 4106d3319..b08737f53 100644 --- a/scintilla/Scintilla.vcxproj +++ b/scintilla/Scintilla.vcxproj @@ -397,6 +397,7 @@ + diff --git a/scintilla/Scintilla.vcxproj.filters b/scintilla/Scintilla.vcxproj.filters index 29b105e7c..b207424d3 100644 --- a/scintilla/Scintilla.vcxproj.filters +++ b/scintilla/Scintilla.vcxproj.filters @@ -671,5 +671,8 @@ win32 + + src + \ No newline at end of file diff --git a/src/Edit.c b/src/Edit.c index 20313da64..b2001cd4d 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -5977,7 +5977,8 @@ void EditMarkAllOccurrences() } if (EditIsInTargetTransaction()) { return; } // do not block, next event occurs for sure - BeginWaitCursor(NULL); + bool const bWaitCursor = (g_iMarkOccurrencesCount > 4000) ? true : false; + if (bWaitCursor) { BeginWaitCursor(NULL); } IgnoreNotifyChangeEvent(); EditEnterTargetTransaction(); @@ -6001,7 +6002,7 @@ void EditMarkAllOccurrences() EditLeaveTargetTransaction(); ObserveNotifyChangeEvent(); - EndWaitCursor(); + if (bWaitCursor) { EndWaitCursor(); } } @@ -6265,7 +6266,8 @@ bool EditReplaceAllInSelection(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bShowIn const DocPos anchorPos = SciCall_GetAnchor(); DocPos enlargement = 0; - BeginWaitCursor(NULL); + bool const bWaitCursor = ((end - start) > (512 * 512)) ? true : false; + if (bWaitCursor) { BeginWaitCursor(NULL); } IgnoreNotifyChangeEvent(); int token = BeginUndoAction(); @@ -6273,7 +6275,7 @@ bool EditReplaceAllInSelection(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bShowIn iReplacedOccurrences = EditReplaceAllInRange(hwnd, lpefr, start, end, &enlargement); ObserveNotifyChangeEvent(); - EndWaitCursor(); + if (bWaitCursor) { EndWaitCursor(); } if (iReplacedOccurrences <= 0) { EndUndoAction(token); @@ -6356,9 +6358,10 @@ bool EditToggleView(HWND hwnd, bool bToggleView) static bool bSaveFoldingAvailable = false; static bool bSaveShowFolding = false; - if (bToggleView) { - - BeginWaitCursor(NULL); + if (bToggleView) + { + bool const bWaitCursor = ((g_iMarkOccurrencesCount > 1000) || (SciCall_GetLineCount() > 2000)) ? true : false; + if (bWaitCursor) { BeginWaitCursor(NULL); } IgnoreNotifyChangeEvent(); if (!bHideNonMatchedLines) { @@ -6388,7 +6391,7 @@ bool EditToggleView(HWND hwnd, bool bToggleView) } ObserveNotifyChangeEvent(); - EndWaitCursor(); + if (bWaitCursor) { EndWaitCursor(); } } return bHideNonMatchedLines; } diff --git a/src/Notepad3.c b/src/Notepad3.c index 8135fe59c..ead1d2382 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -5785,11 +5785,11 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam) MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); } } - // ignoring SC_UPDATE_CONTENT cause Style and Marker are out of scope here - // using WM_COMMAND -> SCEN_CHANGE instead! - //else if (scn->updated & SC_UPDATE_CONTENT) { - // MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); - //} + else if (scn->updated & SC_UPDATE_CONTENT) { + // ignoring SC_UPDATE_CONTENT cause Style and Marker are out of scope here + // using WM_COMMAND -> SCEN_CHANGE instead! + //~MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); + } } if (g_bHyperlinkHotspot) {