diff options
author | nyamatongwe <devnull@localhost> | 2001-08-10 07:51:38 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2001-08-10 07:51:38 +0000 |
commit | c041cb3a32ba6d66ecde5ef8d63687a02ff9fa89 (patch) | |
tree | 6a77531f3b80defd80fd8736d392155f10ec7be7 | |
parent | 3a1af4ce66bfc718c0cdba34716a46586d8eacfb (diff) | |
download | scintilla-mirror-c041cb3a32ba6d66ecde5ef8d63687a02ff9fa89.tar.gz |
Folding is started 1 line earlier than is being restyled to handle cases
where the deletion of a line end is leading to a bad fold state for that
line.
-rw-r--r-- | src/KeyWords.cxx | 9 | ||||
-rw-r--r-- | src/LexCPP.cxx | 5 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/KeyWords.cxx b/src/KeyWords.cxx index 265dbf565..d954a64e2 100644 --- a/src/KeyWords.cxx +++ b/src/KeyWords.cxx @@ -68,8 +68,15 @@ void LexerModule::Lex(unsigned int startPos, int lengthDoc, int initStyle, void LexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle, WordList *keywordlists[], Accessor &styler) { - if (fnFolder) + if (fnFolder) { + int lineCurrent = styler.GetLine(startPos); + // Move back one line in case deletion wrecked current line fold state + if (lineCurrent > 0) { + lineCurrent--; + startPos = styler.LineStart(lineCurrent); + } fnFolder(startPos, lengthDoc, initStyle, keywordlists, styler); + } } static void ColouriseNullDoc(unsigned int startPos, int length, int, WordList *[], diff --git a/src/LexCPP.cxx b/src/LexCPP.cxx index c5e55df8b..0b1e532c4 100644 --- a/src/LexCPP.cxx +++ b/src/LexCPP.cxx @@ -335,11 +335,6 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordLis unsigned int endPos = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); - // Move back one line in case deletion wrecked current line fold state - if (lineCurrent > 0) { - lineCurrent--; - startPos = styler.LineStart(lineCurrent); - } int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; |