aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJad Altahan <xviyy@aol.com>2019-01-13 17:55:32 +1100
committerJad Altahan <xviyy@aol.com>2019-01-13 17:55:32 +1100
commit1dfe7a614cb1f76a00942dbe71cfda7206e42144 (patch)
tree096eb12d382d084b9f89129dd4802d267ffc51a3
parentfd351d35210b90cdf278f9f33ceef234d1e08ea5 (diff)
downloadscintilla-mirror-1dfe7a614cb1f76a00942dbe71cfda7206e42144.tar.gz
Backport: Feature [feature-requests:#1254]. Fix bug causing fold line creation in comments
Backport of changeset 7230:8bfffdf3bbc0.
-rw-r--r--doc/ScintillaHistory.html4
-rw-r--r--lexers/LexNim.cxx11
2 files changed, 10 insertions, 5 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index f6c23be51..254846759 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -552,6 +552,10 @@
Fix raw strings in nim.
<a href="https://sourceforge.net/p/scintilla/feature-requests/1253/">Feature #1253</a>.
</li>
+ <li>
+ Fix fold behaviour with comments in nim.
+ <a href="https://sourceforge.net/p/scintilla/feature-requests/1254/">Feature #1254</a>.
+ </li>
</ul>
<h3>
<a href="https://sourceforge.net/projects/scintilla/files/scintilla/3.10.2/scintilla3102.zip/download">Release 3.10.2</a>
diff --git a/lexers/LexNim.cxx b/lexers/LexNim.cxx
index b61f33cc8..fae9e8d6e 100644
--- a/lexers/LexNim.cxx
+++ b/lexers/LexNim.cxx
@@ -99,10 +99,8 @@ int GetIndent(const Sci_Position line, Accessor &styler) {
bool inPrevPrefix = line > 0;
Sci_Position posPrev = inPrevPrefix ? styler.LineStart(line - 1) : 0;
- // No fold points inside block comments and triple literals
- while ((IsASpaceOrTab(ch)
- || IsStreamComment(style)
- || IsTripleLiteral(style)) && (startPos < eolPos)) {
+ // No fold points inside triple literals
+ while ((IsASpaceOrTab(ch) || IsTripleLiteral(style)) && (startPos < eolPos)) {
if (inPrevPrefix) {
char chPrev = styler[posPrev++];
if (chPrev != ' ' && chPrev != '\t') {
@@ -121,11 +119,14 @@ int GetIndent(const Sci_Position line, Accessor &styler) {
style = styler.StyleAt(startPos);
}
- indent += SC_FOLDLEVELBASE;
+ // Prevent creating fold lines for comments if indented
+ if (!(IsStreamComment(style) || IsLineComment(style)))
+ indent += SC_FOLDLEVELBASE;
if (styler.LineStart(line) == styler.Length()
|| IsASpaceOrTab(ch)
|| IsNewline(ch)
+ || IsStreamComment(style)
|| IsLineComment(style)) {
return indent | SC_FOLDLEVELWHITEFLAG;
} else {