]> git.lyx.org Git - features.git/commitdiff
Mark inserted/deleted end of paragraph using pilcrow
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 21 Mar 2019 10:27:51 +0000 (11:27 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:18 +0000 (15:48 +0200)
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.

src/RowPainter.cpp
src/TextMetrics.cpp

index 718b1a9aeaea435a9b4c6ceac2e3ca7d3c30cd63..a88ac2a6be39bd7a8bd2794aee1f9fdf6b2aaf6f 100644 (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: {
index 88ffa6f874bef6aa8f9badab41a9615235081d01..a29b4dca77edf74f8cd9917886cda721ca4a484b 100644 (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?