- if (!change.changed())
- return;
- // Calculate 1/3 height of font
- FontMetrics const & fm = theFontMetrics(font);
- int const y_bar = change.deleted() ? yo_ - fm.maxAscent() / 3
- : yo_ + 2 * solid_line_offset_ + solid_line_thickness_;
- pi_.pain.line(int(orig_x), y_bar, int(x_), y_bar,
- change.color(), Painter::line_solid, solid_line_thickness_);
-}
-
-
-void RowPainter::paintFromPos(pos_type & vpos, bool changed)
-{
- pos_type pos = bidi_.vis2log(vpos);
- pos_type start_pos = pos;
- // first character
- docstring str;
- str.reserve(100);
- char_type const c = par_.getChar(pos);
- str.push_back(c);
-
- double const orig_x = x_;
-
- Font const font = text_metrics_.displayFont(pit_, pos);
- FontSpan const font_span = par_.fontSpan(pos);
- // Track-change status.
- Change const & change_running = par_.lookupChange(pos);
-
- // collect as much similar chars as we can
- pos_type const end = row_.endpos();
- for (++vpos ; vpos < end ; ++vpos) {
- pos = bidi_.vis2log(vpos);
-
- if (!font_span.contains(pos))
- break;
-
- Change const & change = par_.lookupChange(pos);
- if (!change_running.isSimilarTo(change))
- // Track change type or author has changed.
- break;
-
- char_type const c = par_.getChar(pos);
-
- if (c == '\t')
- break;
-
- if (!isPrintableNonspace(c))
- break;
-
- str.push_back(c);
- }
-
- // Make pos point to the last character in the string.
- // Using "pos = bidi_.vis2log(vpos)" does not work for some reason.
- if (vpos < end)
- pos = bidi_.vis2log(vpos - 1);
-
- // Now make pos point to the position _after_ the string.
- // Using vis2log for that is not a good idea in general, we
- // want logical ordering.
- if (font.isVisibleRightToLeft())
- --pos;
- else
- ++pos;
-
- if (str[0] == '\t')
- str.replace(0,1,from_ascii(" "));
-
- /* Because we do our own bidi, at this point the strings are
- * already in visual order. However, Qt also applies its own
- * bidi algorithm to strings that it paints to the screen.
- * Therefore, if we were to paint Hebrew/Arabic words as a
- * single string, the letters in the words would get reversed
- * again. In order to avoid that, we reverse our string.
- * See also http://thread.gmane.org/gmane.editors.lyx.devel/79740
- * for an earlier thread on the subject
- */
- if (font.isVisibleRightToLeft()) {
- reverse(str.begin(), str.end());
- // If the string is reversed, the positions need to be adjusted
- ++pos;
- ++start_pos;
- swap(start_pos, pos);
- }
-
- // Actually paint the text, taking care about the selection
- paintStringAndSel(str, font, change_running, start_pos, pos);
-
- // The line that indicates word in a different language
- paintForeignMark(orig_x, font.language());
-
- // Paint the spelling mark if needed.
- if (lyxrc.spellcheck_continuously && pi_.do_spellcheck
- && par_.isMisspelled(start_pos)) {
- paintMisspelledMark(orig_x, str, font, start_pos, changed);
- }