Created attachment 54066 [details] offending.sql Version: SVN (using KDE 4.5.4) OS: Linux possibly related to #252348 wc ~/tmp/offending.sql 3 4109 340191 /home/vivo/tmp/offending.sql The test file has 3 lines, the 2nd one more than 300 kchar long. kate honestly try to higlight all the 300kc but the cpu is not very much happy. the problems lies in - kate/part/render/katerenderer.cpp - kate/part/render/katelayoutcache.cpp - QT QTextLayout::beginLayout and QTextLayout::draw Just renaming the file from .sql to .txt make the problem disappear (well not really, more on this later **) It's not possible to highlight indefinitly big files and lines at once so the solutions I see are: 1) do the equivalent of wc prior to open (or paste) into the file, if the numbers are crazy switch indenting off (bonus make crazy numbers configurable) PROS: easy and cheap PROS: often very long lines files does not need HL (not the case of sql tough) CONS: user bang the head on monitor screaming WTF 2) apply "clipping" to text, similarly to what happening in computer graphics PROS: user may be more happy but he will have random surprises CONS: much more difficult may need QTextLayout subclassing, CONS: grammars rarely survive to clipping 3) apply higlight only on the first X columns with X larger than any ludicrous monitor using 8px fonts, the rest of the line should be rendered as plain text PROS: should survive better with many grammars CONS: super human master of coding needed? ** kate Version 3.5.4 shippped with KDE Development Platform 4.5.4 break even with offending.txt if it has only 3 lines, adding 60 (more than monitor height) short lines at the beginning make the problem disappear. Even when scolling to the infamous 300kc line. With this same version of kate I've seen a (unreproducible) bug saving the file triggered a very long QTextLayout::beginLayout Reproducible: Always Steps to Reproduce: kate ~/tmp/offending.sql Actual Results: cpu at 100% utilization for very long time Expected Results: cpu at 99% utilization for a small time Set the severity to Normal because kate need to be killed when stall like this, with possible data loss
see 225228 on why your ideas are not feasible *** This bug has been marked as a duplicate of bug 225228 ***