diff options
| author | nyamatongwe <unknown> | 2005-06-29 02:44:39 +0000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2005-06-29 02:44:39 +0000 | 
| commit | b537a01cd13f5b714ffc9123cad4a6a7ec46cd7b (patch) | |
| tree | de18bbf4eac0e2b27ec61a5adf12c0757a61c698 /src/ScintillaBase.cxx | |
| parent | 81bea3ef315f41894bd8554cdcd982bc44ec9ab7 (diff) | |
| download | scintilla-mirror-b537a01cd13f5b714ffc9123cad4a6a7ec46cd7b.tar.gz | |
Prevent reentance of styling which could occur when a styler added a fold
point and this caused a search for subordinate lines which then tried to
style further.
Diffstat (limited to 'src/ScintillaBase.cxx')
| -rw-r--r-- | src/ScintillaBase.cxx | 25 | 
1 files changed, 17 insertions, 8 deletions
| diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index c70e2055d..e3aeadc25 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -41,6 +41,7 @@ ScintillaBase::ScintillaBase() {  	maxListWidth = 0;  #ifdef SCI_LEXER  	lexLanguage = SCLEX_CONTAINER; +	performingStyle = false;  	lexCurrent = 0;  	for (int wl = 0;wl < numWordLists;wl++)  		keyWordLists[wl] = new WordList; @@ -469,16 +470,24 @@ void ScintillaBase::Colourise(int start, int end) {  #endif  void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) { +	if (!performingStyle) { +		// Protect against reentrance, which may occur, for example, when +		// fold points are discovered while performing styling and the folding +		// code looks for child lines which may trigger styling. +		performingStyle = true;  #ifdef SCI_LEXER -	if (lexLanguage != SCLEX_CONTAINER) { -		int endStyled = WndProc(SCI_GETENDSTYLED, 0, 0); -		int lineEndStyled = WndProc(SCI_LINEFROMPOSITION, endStyled, 0); -		endStyled = WndProc(SCI_POSITIONFROMLINE, lineEndStyled, 0); -		Colourise(endStyled, endStyleNeeded); -		return; -	} +		if (lexLanguage != SCLEX_CONTAINER) { +			int endStyled = WndProc(SCI_GETENDSTYLED, 0, 0); +			int lineEndStyled = WndProc(SCI_LINEFROMPOSITION, endStyled, 0); +			endStyled = WndProc(SCI_POSITIONFROMLINE, lineEndStyled, 0); +			Colourise(endStyled, endStyleNeeded); +			performingStyle = false; +			return; +		}  #endif -	Editor::NotifyStyleToNeeded(endStyleNeeded); +		Editor::NotifyStyleToNeeded(endStyleNeeded); +		performingStyle = false; +	}  }  sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { | 
