Commit 68cec6a7 authored by Christian Kamm's avatar Christian Kamm
Browse files

QmlJS: Fix folding information for multi-line comments after edits.

Since the highlighter doesn't run on the whole file, only on the changed
line, we need to store the information whether a block starts in a
multi-line comment.

Reviewed-by: Erik Verbruggen
parent 381c5406
......@@ -309,6 +309,7 @@ int Highlighter::onBlockStart()
m_currentBlockParentheses.clear();
m_braceDepth = 0;
m_foldingIndent = 0;
m_inMultilineComment = false;
if (TextEditor::TextBlockUserData *userData = TextEditor::BaseTextDocumentLayout::testUserData(currentBlock())) {
userData->setFoldingIndent(0);
userData->setFoldingStartIncluded(false);
......@@ -319,7 +320,8 @@ int Highlighter::onBlockStart()
int previousState = previousBlockState();
if (previousState != -1) {
state = previousState & 0xff;
m_braceDepth = previousState >> 8;
m_inMultilineComment = (previousState >> 8) & 0xff;
m_braceDepth = previousState >> 16;
}
m_foldingIndent = m_braceDepth;
......@@ -330,7 +332,7 @@ void Highlighter::onBlockEnd(int state)
{
typedef TextEditor::TextBlockUserData TextEditorBlockData;
setCurrentBlockState((m_braceDepth << 8) | state);
setCurrentBlockState((m_braceDepth << 16) | (m_inMultilineComment << 8) | state);
TextEditor::BaseTextDocumentLayout::setParentheses(currentBlock(), m_currentBlockParentheses);
TextEditor::BaseTextDocumentLayout::setFoldingIndent(currentBlock(), m_foldingIndent);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment