Am 14.03.2008 um 15:05 schrieb Dov Feldstern:

Hi!

There's a small problem with the text completion and RTL text:

The grayed-out inline completion appears backwards in RTL text (see attached image).

I can explain why it is happening (and why this problem wasn't observed when RTL was tested with latin characters), but I don't know how to easily solve the issue. The reason is something like this: when painting text, LyX applies the bidi algorithm, so that the string that it ultimately passes to Qt for painting is already in visual order; however, Qt 4 now applies its own bidi algorithm to all strings that it paints, and it doesn't seem to provide any API for saying "the string is already in visual order, just paint it as it is". To get around this problem, we paint RTL strings one character at a time (see http://www.lyx.org/trac/browser/lyx-devel/trunk/src/rowpainter.cpp?rev=23522#L259) . But I imagine that the grayed-out inline completion is painted as a full string...

I haven't looked at the completion code at all, so I'm not sure exactly what's going on; but I'm pretty sure that this is the correct explanation of the problem. Any ideas on what can be done to solve it?

I have to check my code as well. The idea was to reverse the string if needed before telling Qt about. But maybe I got something wrong in this logic. Take a look at RowPainter::paintInlineCompletion. That's the code for the text mode.

It's a bit more involved than you might expect, because the inline completion consists of the unique part (drawn in dark grey) and the non-unique part (drawn in light grey).

I do a reversal of the rtl text there. No idea why it does not work. Or maybe Qt its own bidi magic?

Stefan

Reply via email to