diff options
| author | Neil <nyamatongwe@gmail.com> | 2019-03-05 11:26:12 +1100 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2019-03-05 11:26:12 +1100 | 
| commit | b1cb174973ade513f60b90ed115d3650d0981394 (patch) | |
| tree | a4f94dbf35487b508faffb43e4c15800a5313d78 | |
| parent | 289b1f2147963852c745a7df02c543849c0553d8 (diff) | |
| download | scintilla-mirror-b1cb174973ade513f60b90ed115d3650d0981394.tar.gz | |
Avoid hangs in idle styling modes caused by high-priority idle work styling.
| -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 c858b31fd..024d1216f 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -566,6 +566,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>      <h3>         <a href="https://www.scintilla.org/scite414.zip">Release 4.1.4</a> diff --git a/src/Editor.cxx b/src/Editor.cxx index 9821b1195..953cae81a 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2662,12 +2662,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);  			}  		} @@ -5068,7 +5072,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 9d0783f09..eb921541f 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); +	constexpr 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); | 
