Commit d6b770586d9b13eae66d33c550c5aba8009541a3

  • avatar
  • con <qtc-committer @no…a.com> (Committer)
  • Mon Nov 23 16:20:29 GMT 2009
  • avatar
  • Thorbjørn Lindeijer (Author)
  • Mon Nov 23 14:15:56 UTC 2009
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)
src/plugins/cppeditor/cpphighlighter.cpp
(1 / 3)
  
4848
4949void CppHighlighter::highlightBlock(const QString &text)
5050{
51 QTextCharFormat emptyFormat;
52
5351 const int previousState = previousBlockState();
5452 int state = 0, initialBraceDepth = 0;
5553 if (previousState != -1) {
223223 if (oldState == tokenize.state() && oldBraceDepth != braceDepth) {
224224 int delta = braceDepth - oldBraceDepth;
225225 QTextBlock block = currentBlock().next();
226 while (block.isValid()) {
226 while (block.isValid() && block.userState() != -1) {
227227 TextEditDocumentLayout::changeBraceDepth(block, delta);
228228 block = block.next();
229229 }

Comments

Add a new comment:

Login or create an account to post a comment

Add your comment