[texworks] [Qt-interest] Disappearing lines when using a syntax highlighter
Paul A Norman
paul.a.norman at gmail.com
Mon Jul 11 09:05:20 CEST 2011
Good one Stefan!
On 11 July 2011 17:44, Stefan Löffler <st.loeffler at gmail.com> wrote:
> I'm a developer of the TeX editor project TeXworks that is based on the
> Qt framework. About half a year ago, the problem of the disappearing
> lines has been reported , but now I finally managed to reproduce it
> in a minimal example (source code and test file attached).
> Here's the problem: when I use a QSyntaxHighlighter-derived class and
> call highlighter.rehighlight() in the initialization, several lines
> simply vanish in the initial display. One has to resize the window
> horizontally (presumably to cause a relayout of the text) to show those
> This seems to depend on the Qt version used. So far, I've tested the
> following ones:
> gcc 4.5.2
> - Qt 4.6.3 (debug) works
> - Qt 4.7.2 (debug) fails, missing lines: 144--147, 154--157, 160--161,
> gcc 4.6.0
> - Qt 4.7.3 fails, missing: 155-157, 160-161, 169-181
> I'm not sure if this is also system-dependent?
> A few things to note:
> - this is independent of the window's initial size, but manual
> horizontal resize works around the problem
> - moving rehighlight() in front of show() apparently solve the problem
> as well (though this might not be possible in real-life if rehighlight
> is tied to signals and/or other parts of the code, e.g., for document
> - the missing lines depend on the highlighting definition (changing
> "%.*$" to "%.+$" made lines 137--143 disappear with Qt 4.7.2)
> - the cursor disappears when moving to hidden lines with the arrow keys
> (the real app, TeXworks, crashes, presumably due to the "highlight
> current line" feature using code from
> Some additional debugging suggests that the text is properly split into
> QTextBlocks, but that those are not (all) laid out properly into
> QTextLines. But that internal layout code is fairly complex...
> Does anyone have any hint as to where this issue comes form or how to
> solve this?
> Thanks in advance,
>  http://code.google.com/p/texworks/issues/detail?id=469
More information about the texworks