aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authoryonken <yonken@gmail.com>2016-10-14 18:40:02 +0800
committeryonken <yonken@gmail.com>2016-10-14 18:40:02 +0800
commit2c2d83f8b2d63137107e0e0ecfb041667d80e52f (patch)
treef676589d6ad1c86a3e4e5484337979732d2aea90
parent3468e74bd70723987dc83ec3623b6839be3a1557 (diff)
downloadscintilla-mirror-2c2d83f8b2d63137107e0e0ecfb041667d80e52f.tar.gz
Fix JSON lexer folding bug.
-rw-r--r--doc/ScintillaHistory.html4
-rw-r--r--lexers/LexJSON.cxx6
2 files changed, 8 insertions, 2 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index ea02b5a4b..ad70afba9 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -504,6 +504,7 @@
</tr>
</tr><tr>
<td>Roberto Rossi</td>
+ <td>Kenny Liu</td>
</tr>
</table>
<p>
@@ -523,6 +524,9 @@
Released 16 October 2016.
</li>
<li>
+ JSON folder fixed where it didn't resume folding with the correct fold level.
+ </li>
+ <li>
Margin click to select line now clears rectangular and additional selections.
</li>
<li>
diff --git a/lexers/LexJSON.cxx b/lexers/LexJSON.cxx
index 9c044e52c..6c060611f 100644
--- a/lexers/LexJSON.cxx
+++ b/lexers/LexJSON.cxx
@@ -457,7 +457,9 @@ void SCI_METHOD LexerJSON::Fold(Sci_PositionU startPos,
LexAccessor styler(pAccess);
Sci_PositionU currLine = styler.GetLine(startPos);
Sci_PositionU endPos = startPos + length;
- int currLevel = styler.LevelAt(currLine) & SC_FOLDLEVELNUMBERMASK;
+ int currLevel = SC_FOLDLEVELBASE;
+ if (currLine > 0)
+ currLevel = styler.LevelAt(currLine - 1) >> 16;
int nextLevel = currLevel;
int visibleChars = 0;
for (Sci_PositionU i = startPos; i < endPos; i++) {
@@ -472,7 +474,7 @@ void SCI_METHOD LexerJSON::Fold(Sci_PositionU startPos,
}
}
if (atEOL || i == (endPos-1)) {
- int level = currLevel;
+ int level = currLevel | nextLevel << 16;
if (!visibleChars && options.foldCompact) {
level |= SC_FOLDLEVELWHITEFLAG;
} else if (nextLevel > currLevel) {