diff options
author | nyamatongwe <devnull@localhost> | 2005-06-29 02:44:39 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2005-06-29 02:44:39 +0000 |
commit | 637c17da9ba8fddbc1a25d20eb37d7aade6d8cf3 (patch) | |
tree | de18bbf4eac0e2b27ec61a5adf12c0757a61c698 /src | |
parent | 6a84eb28b5f0bfd9d2bba3c03b6386671d0e757e (diff) | |
download | scintilla-mirror-637c17da9ba8fddbc1a25d20eb37d7aade6d8cf3.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')
-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) { |