Browse Source

fix outline bug in edit mode

Avoid taking the # in code block as a header by mistake.

Signed-off-by: Le Tan <[email protected]>
Le Tan 9 years ago
parent
commit
d77b333343
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/vedit.cpp

+ 2 - 1
src/vedit.cpp

@@ -180,7 +180,8 @@ void VEdit::generateEditOutline()
     QRegExp headerReg("(#{1,6})\\s*(\\S.*)");  // Need to trim the spaces
     for (QTextBlock block = doc->begin(); block != doc->end(); block = block.next()) {
         Q_ASSERT(block.lineCount() == 1);
-        if (headerReg.exactMatch(block.text())) {
+        if ((block.userState() == HighlightBlockState::BlockNormal) &&
+            headerReg.exactMatch(block.text())) {
             VHeader header(headerReg.cap(1).length(),
                            headerReg.cap(2).trimmed(), "", block.firstLineNumber());
             headers.append(header);