- DocIterator const & inlineCompletionPos = bv.inlineCompletionPos();
- MathData const * inlineCompletionData = 0;
- if (inlineCompletionPos.inMathed())
- inlineCompletionData = &inlineCompletionPos.cell();
-
- CoordCache::Insets & coords = pi.base.bv->coordCache().insets();
- for (size_t i = 0, n = size(); i != n; ++i) {
- MathAtom const & at = operator[](i);
- coords.add(at.nucleus(), x, y);
- at->drawSelection(pi, x, y);
- at->draw(pi, x, y);
- x += coords.dim(at.nucleus()).wid;
-
- // Is the inline completion here?
- if (inlineCompletionData != this
- || size_t(inlineCompletionPos.pos()) != i + 1)
- continue;
- docstring const & completion = bv.inlineCompletion();
- if (completion.length() == 0)
- continue;
- FontInfo f = pi.base.font;
- augmentFont(f, from_ascii("mathnormal"));
-
- // 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 = bv.inlineCompletionUniqueChars();
- docstring s1 = completion.substr(0, uniqueTo);
- docstring s2 = completion.substr(uniqueTo);
-
- if (!s1.empty()) {
- f.setColor(Color_inlinecompletion);
- pi.pain.text(x, y, s1, f);
- x += mathed_string_width(f, s1);
- }
-
- if (!s2.empty()) {
- f.setColor(Color_nonunique_inlinecompletion);
- pi.pain.text(x, y, s2, f);
- x += mathed_string_width(f, s2);
- }
- }