diff options
author | mitchell <unknown> | 2019-03-31 21:57:39 -0400 |
---|---|---|
committer | mitchell <unknown> | 2019-03-31 21:57:39 -0400 |
commit | aa255d832bd769d2814c5bffcce30d02ccd27208 (patch) | |
tree | 6b0d0690603c1217532c592a953b1675c6bf876c | |
parent | b64609f6d058cf9da84b43a28b7d7610770a06a8 (diff) | |
download | scintilla-mirror-aa255d832bd769d2814c5bffcce30d02ccd27208.tar.gz |
Backport Avoid hangs in idle styling modes caused by high-priority idle work styling.
Backport of changeset 7315:57ea0255c8aa, but without constexpr, as non-static
data members cannot be constexpr in C++11.
-rw-r--r-- | doc/ScintillaHistory.html | 3 | ||||
-rw-r--r-- | src/Editor.cxx | 10 | ||||
-rw-r--r-- | src/Editor.h | 3 |
3 files changed, 13 insertions, 3 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index c9ce0e72b..4b00440b4 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -556,6 +556,9 @@ <li> On Win32, removed special handling of non-0 wParam to WM_PAINT. </li> + <li> + Avoid potential long hangs with idle styling for huge documents on Cocoa and GTK. + </li> <ul> <a href="https://sourceforge.net/projects/scintilla/files/scintilla/3.10.3/scintilla3103.zip/download">Release 3.10.3</a> </h3> diff --git a/src/Editor.cxx b/src/Editor.cxx index f059a8243..94e1f6164 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2659,12 +2659,16 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) { } if (paintState == notPainting && !CanDeferToLastStep(mh)) { - QueueIdleWork(WorkNeeded::workStyle, pdoc->Length()); + if (SynchronousStylingToVisible()) { + QueueIdleWork(WorkNeeded::workStyle, pdoc->Length()); + } Redraw(); } } else { if (paintState == notPainting && mh.length && !CanEliminate(mh)) { - QueueIdleWork(WorkNeeded::workStyle, mh.position + mh.length); + if (SynchronousStylingToVisible()) { + QueueIdleWork(WorkNeeded::workStyle, mh.position + mh.length); + } InvalidateRange(mh.position, mh.position + mh.length); } } @@ -5065,7 +5069,7 @@ void Editor::StyleToPositionInView(Sci::Position pos) { } Sci::Position Editor::PositionAfterMaxStyling(Sci::Position posMax, bool scrolling) const { - if ((idleStyling == SC_IDLESTYLING_NONE) || (idleStyling == SC_IDLESTYLING_AFTERVISIBLE)) { + if (SynchronousStylingToVisible()) { // Both states do not limit styling return posMax; } diff --git a/src/Editor.h b/src/Editor.h index 29150276a..cbdd171cf 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -522,6 +522,9 @@ protected: // ScintillaBase subclass needs access to much of Editor Sci::Position PositionAfterMaxStyling(Sci::Position posMax, bool scrolling) const; void StartIdleStyling(bool truncatedLastStyling); void StyleAreaBounded(PRectangle rcArea, bool scrolling); + bool SynchronousStylingToVisible() const noexcept { + return (idleStyling == SC_IDLESTYLING_NONE) || (idleStyling == SC_IDLESTYLING_AFTERVISIBLE); + } void IdleStyling(); virtual void IdleWork(); virtual void QueueIdleWork(WorkNeeded::workItems items, Sci::Position upTo=0); |