Mark inserted/deleted end of paragraph using pilcrow

Instead of the weird corner line, display a pilcrow sign (even when
disabled in prefs) to mark inserted/deleted end of paragraph.

Incidentally, this fixes the recent placement bug of the corner line.
This commit is contained in:
Jean-Marc Lasgouttes 2019-03-21 11:27:51 +01:00
parent 5d30f790dd
commit c2732a30f9
2 changed files with 4 additions and 26 deletions

View File

@ -507,30 +507,6 @@ static int getEndLabel(pit_type p, Text const & text)
void RowPainter::paintLast() const
{
int const endlabel = getEndLabel(row_.pit(), text_);
// paint imaginary end-of-paragraph character
Change const & change = par_.lookupChange(par_.size());
if (change.changed()) {
FontMetrics const & fm =
theFontMetrics(pi_.base.bv->buffer().params().getFont());
int const length = fm.maxAscent() / 2;
Color col = change.color();
pi_.pain.line(int(x_) + 1, yo_ + 2, int(x_) + 1, yo_ + 2 - length, col,
Painter::line_solid, 3);
if (change.deleted()) {
pi_.pain.line(int(x_) + 1 - length, yo_ + 2, int(x_) + 1 + length,
yo_ + 2, col, Painter::line_solid, 3);
} else {
pi_.pain.line(int(x_) + 1 - length, yo_ + 2, int(x_) + 1,
yo_ + 2, col, Painter::line_solid, 3);
}
}
// draw an endlabel
switch (endlabel) {
case END_LABEL_BOX:
case END_LABEL_FILLED_BOX: {

View File

@ -1001,7 +1001,9 @@ bool TextMetrics::breakRow(Row & row, int const right_margin) const
// End of paragraph marker. The logic here is almost the
// same as in redoParagraph, remember keep them in sync.
ParagraphList const & pars = text_->paragraphs();
if (lyxrc.paragraph_markers && !need_new_row
Change const & change = par.lookupChange(i);
if ((lyxrc.paragraph_markers || change.changed())
&& !need_new_row
&& i == end && size_type(row.pit() + 1) < pars.size()) {
// add a virtual element for the end-of-paragraph
// marker; it is shown on screen, but does not exist
@ -1012,7 +1014,7 @@ bool TextMetrics::breakRow(Row & row, int const right_margin) const
= text_->inset().buffer().params();
f.setLanguage(par.getParLanguage(bparams));
// ¶ U+00B6 PILCROW SIGN
row.addVirtual(end, docstring(1, char_type(0x00B6)), f, Change());
row.addVirtual(end, docstring(1, char_type(0x00B6)), f, change);
}
// Is there a end-of-paragaph change?