FontSpan const font_span = par_.fontSpan(pos);
// Track-change status.
Change const & change_running = par_.lookupChange(pos);
-
+
// selected text?
bool const selection = pos >= row_.sel_beg && pos < row_.sel_end;
+ char_type prev_char = ' ';
// collect as much similar chars as we can
for (++vpos ; vpos < end ; ++vpos) {
pos = bidi_.vis2log(vpos);
char_type c = par_.getChar(pos);
+ if (c == '\t' || prev_char == '\t') {
+ prev_char = c;
+ break;
+ }
+
if (!isPrintableNonspace(c))
break;
docstring s(&str[0], str.size());
+ if (s[0] == '\t')
+ s.replace(0,1,from_ascii(" "));
+
if (!selection && !change_running.changed()) {
x_ += pi_.pain.text(int(x_), yo_, s, font);
return;
Change const & change = par_.lookupChange(par_.size());
if (change.changed()) {
- FontMetrics const & fm =
+ FontMetrics const & fm =
theFontMetrics(pi_.base.bv->buffer().params().getFont());
int const length = fm.maxAscent() / 2;
ColorCode col = change.color();
pi_.pain.line(int(x_) + 1, yo_ + 2, int(x_) + 1, yo_ + 2 - length, col,
Painter::line_solid, Painter::line_thick);
-
+
if (change.deleted()) {
- pi_.pain.line(int(x_) + 1 - length, yo_ + 2, int(x_) + 1 + length,
+ pi_.pain.line(int(x_) + 1 - length, yo_ + 2, int(x_) + 1 + length,
yo_ + 2, col, Painter::line_solid, Painter::line_thick);
} else {
- pi_.pain.line(int(x_) + 1 - length, yo_ + 2, int(x_) + 1,
+ pi_.pain.line(int(x_) + 1 - length, yo_ + 2, int(x_) + 1,
yo_ + 2, col, Painter::line_solid, Painter::line_thick);
}
Change change_running;
int change_last_x = 0;
-
+
// check for possible inline completion
DocIterator const & inlineCompletionPos = pi_.base.bv->inlineCompletionPos();
pos_type inlineCompletionVPos = -1;
// If we reach the end of a change or if the author changes, paint it.
// We also don't paint across things like tables
- if (change_running.changed() && (highly_editable_inset
+ if (change_running.changed() && (highly_editable_inset
|| !change.changed() || !change_running.isSimilarTo(change))) {
// Calculate 1/3 height of the buffer's default font
FontMetrics const & fm
= theFontMetrics(pi_.base.bv->buffer().params().getFont());
- int const y_bar = change_running.deleted() ?
+ int const y_bar = change_running.deleted() ?
yo_ - fm.maxAscent() / 3 : yo_ + fm.maxAscent() / 6;
pi_.pain.line(change_last_x, y_bar, int(x_), y_bar,
- change_running.color(), Painter::line_solid,
+ change_running.color(), Painter::line_solid,
Painter::line_thin);
-
+
// Change might continue with a different author or type
if (change.changed() && !highly_editable_inset) {
change_running = change;
change_last_x = int(x_);
- } else
+ } else
change_running.setUnchanged();
}
if (change_running.changed()) {
FontMetrics const & fm
= theFontMetrics(pi_.base.bv->buffer().params().getFont());
- int const y_bar = change_running.deleted() ?
+ int const y_bar = change_running.deleted() ?
yo_ - fm.maxAscent() / 3 : yo_ + fm.maxAscent() / 6;
pi_.pain.line(change_last_x, y_bar, int(x_), y_bar,
change_running.color(), Painter::line_solid, Painter::line_thin);