Commit d6b770586d9b13eae66d33c550c5aba8009541a3
Fixed a potential issue with automatic brace matching
When encountering a line that hasn't been highlighted yet, we need to
abort the optimization for changing brace depth.
Done with Roberto Raggi and mae.
(cherry picked from commit 6894cd0b2ee5c788db407435f947d0128bc54c98)
| |   |
| 48 | 48 | |
| 49 | 49 | void CppHighlighter::highlightBlock(const QString &text) |
| 50 | 50 | { |
| QTextCharFormat emptyFormat; |
|
| 53 | 51 | const int previousState = previousBlockState(); |
| 54 | 52 | int state = 0, initialBraceDepth = 0; |
| 55 | 53 | if (previousState != -1) { |
| … | … | |
| 223 | 223 | if (oldState == tokenize.state() && oldBraceDepth != braceDepth) { |
| 224 | 224 | int delta = braceDepth - oldBraceDepth; |
| 225 | 225 | QTextBlock block = currentBlock().next(); |
| while (block.isValid()) { |
| while (block.isValid() && block.userState() != -1) { |
| 227 | 227 | TextEditDocumentLayout::changeBraceDepth(block, delta); |
| 228 | 228 | block = block.next(); |
| 229 | 229 | } |