[Interest] Highlighting: huge rule numbers [hang app]

Sensei senseiwa at gmail.com
Wed Jun 5 15:32:31 CEST 2013


Hi! I am trying to find the limits of the syntax highlighter example.

I am adding rules that begin with "\", but when I hit the backslash, my 
application starts to show the threatening spin wheel of death... and I 
obviously need to kill it.

At the bottom you will see the code where, after killing the program, 
the debugger says it stopped.

My rules are ~5000.

Is there any "smart" way of handling this large number of rules?


Thanks & Cheers!



     foreach (const HighlightingRule &rule, highlightingRules) {
         QRegExp expression(rule.pattern);
         int index = expression.indexIn(text);
         while (index >= 0) {
             int length = expression.matchedLength();
             setFormat(index, length, rule.format);
             index = expression.indexIn(text, index + length);
             // ^ ^ ^ ^ ^ ^ ^
             // | | | | | | |
             // Here it stops with SIGTERM
         }
     }



More information about the Interest mailing list