From 80c7945aff05cb19cc21955324b4e1327ec52764 Mon Sep 17 00:00:00 2001 From: Joe Mueller Date: Thu, 29 Jan 2015 07:57:52 -0800 Subject: fix problem with folding comments by re-folding the previous line as was done in LexerModule::Fold --- lexers/LexVerilog.cxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lexers/LexVerilog.cxx b/lexers/LexVerilog.cxx index f4e4a8344..fdafbddc3 100644 --- a/lexers/LexVerilog.cxx +++ b/lexers/LexVerilog.cxx @@ -756,9 +756,20 @@ void SCI_METHOD LexerVerilog::Fold(unsigned int startPos, int length, int initSt bool foldAtBrace = 1; bool foldAtParenthese = 1; + int lineCurrent = styler.GetLine(startPos); + // Move back one line to be compatible with LexerModule::Fold behavior, fixes problem with foldComment behavior + if (lineCurrent > 0) { + lineCurrent--; + int newStartPos = styler.LineStart(lineCurrent); + length += startPos - newStartPos; + startPos = newStartPos; + initStyle = 0; + if (startPos > 0) { + initStyle = styler.StyleAt(startPos - 1); + } + } unsigned int endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; -- cgit v1.2.3