diff options
| author | Jad Altahan <xviyy@aol.com> | 2019-01-13 17:55:32 +1100 | 
|---|---|---|
| committer | Jad Altahan <xviyy@aol.com> | 2019-01-13 17:55:32 +1100 | 
| commit | 23bcda19cef8666d1a4063b5a69b0836538bb076 (patch) | |
| tree | d6842599985956e436c117c67ca1d0a3496f8b18 | |
| parent | 3e46dafe55b841270f344a393e8daa5e8f9db9b5 (diff) | |
| download | scintilla-mirror-23bcda19cef8666d1a4063b5a69b0836538bb076.tar.gz | |
Feature [feature-requests:#1254]. Fix bug causing fold line creation in comments
| -rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
| -rw-r--r-- | lexers/LexNim.cxx | 11 | 
2 files changed, 10 insertions, 5 deletions
| diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 6af1ec7d3..af5a5f069 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -562,6 +562,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://www.scintilla.org/scite413.zip">Release 4.1.3</a> diff --git a/lexers/LexNim.cxx b/lexers/LexNim.cxx index 68b20fcc3..52a8c7fd7 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 { | 
