-// lyxerr << " paintPar: pit: " << pit << " at y: " << y << endl;
- int const ww = pi.base.bv->workHeight();
-
- pi.base.bv->coordCache().parPos()[&text][pit] = Point(x, y);
-
- TextMetrics const & tm = pi.base.bv->textMetrics(&text);
- ParagraphMetrics const & pm = tm.parMetrics(pit);
- if (pm.rows().empty())
- return;
-
- RowList::const_iterator const rb = pm.rows().begin();
- RowList::const_iterator const re = pm.rows().end();
-
- Bidi bidi;
-
- y -= rb->ascent();
- size_type rowno = 0;
- for (RowList::const_iterator rit = rb; rit != re; ++rit, ++rowno) {
- y += rit->ascent();
- // Row signature; has row changed since last paint?
- bool row_has_changed = pm.rowChangeStatus()[rowno];
-
- bool cursor_on_row = CursorOnRow(pi, pit, rit, text);
-
- // If selection is on, the current row signature differs
- // from cache, or cursor is inside an inset _on this row_,
- // then paint the row
- if (repaintAll || row_has_changed || cursor_on_row) {
- bool const inside = (y + rit->descent() >= 0
- && y - rit->ascent() < ww);
- // it is not needed to draw on screen if we are not inside.
- pi.pain.setDrawingEnabled(inside);
- RowPainter rp(pi, text, pit, *rit, bidi, x, y);
- // Clear background of this row
- // (if paragraph background was not cleared)
- if (!repaintAll && row_has_changed)
- pi.pain.fillRectangle(x, y - rit->ascent(),
- tm.width(), rit->height(),
- text.backgroundColor());
-
- // Instrumentation for testing row cache (see also
- // 12 lines lower):
- if (lyxerr.debugging(Debug::PAINTING)) {
- if (text.isMainText(pi.base.bv->buffer()))
- LYXERR(Debug::PAINTING) << "#";
- else
- LYXERR(Debug::PAINTING) << "[" <<
- repaintAll << row_has_changed <<
- cursor_on_row << "]";
- }
- rp.paintAppendix();
- rp.paintDepthBar();
- rp.paintChangeBar();
- if (rit == rb)
- rp.paintFirst();
- rp.paintText();
- if (rit + 1 == re)
- rp.paintLast();
- }
- y += rit->descent();
+ docstring completion = pi_.base.bv->inlineCompletion();
+ FontInfo f = font.fontInfo();
+ bool rtl = font.isRightToLeft();
+
+ // draw the unique and the non-unique completion part
+ // Note: this is not time-critical as it is
+ // only done once per screen.
+ size_t uniqueTo = pi_.base.bv->inlineCompletionUniqueChars();
+ docstring s1 = completion.substr(0, uniqueTo);
+ docstring s2 = completion.substr(uniqueTo);
+ ColorCode c1 = Color_inlinecompletion;
+ ColorCode c2 = Color_nonunique_inlinecompletion;
+
+ // right to left?
+ if (rtl) {
+ swap(s1, s2);
+ swap(c1, c2);