]> git.lyx.org Git - lyx.git/blobdiff - src/TextMetrics.cpp
Cmake export tests: Ignore missing glyphs on some tests
[lyx.git] / src / TextMetrics.cpp
index 52cbcef50c184479b1c6b268d41c4ac77b1d587a..f38c78d3ea7d98e6799d17a41898eafe8bba1049 100644 (file)
@@ -420,10 +420,21 @@ bool TextMetrics::redoParagraph(pit_type const pit)
                                parPos.pos()++;
                }
 
+               // If there is an end of paragraph marker, its size should be
+               // substracted to the available width. The logic here is
+               // almost the same as in breakRow, remember keep them in sync.
+               int eop = 0;
+               if (lyxrc.paragraph_markers && ii->pos + 1 == par.size()
+                   && size_type(pit + 1) < text_->paragraphs().size()) {
+                       Font f(text_->layoutFont(pit));
+                       // ΒΆ U+00B6 PILCROW SIGN
+                       eop = theFontMetrics(f).width(char_type(0x00B6));
+               }
+
                // do the metric calculation
                Dimension dim;
                int const w = max_width_ - leftMargin(max_width_, pit, ii->pos)
-                       - right_margin;
+                       - right_margin - eop;
                Font const & font = ii->inset->inheritFont() ?
                        displayFont(pit, ii->pos) : bufferfont;
                MacroContext mc(&buffer, parPos);
@@ -933,7 +944,8 @@ bool TextMetrics::breakRow(Row & row, int const right_margin) const
        row.finalizeLast();
        row.endpos(i);
 
-       // End of paragraph marker
+       // 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
            && i == end && size_type(row.pit() + 1) < pars.size()) {
@@ -1367,7 +1379,9 @@ Inset * TextMetrics::editXY(Cursor & cur, int x, int y,
 
        // Try to descend recursively inside the inset.
        Inset * edited = inset->editXY(cur, x, y);
-       if (edited == inset && cur.pos() == it->pos) {
+       // FIXME: it is not clear that the test on position is needed
+       // Remove it if/when semantics of editXY is clarified
+       if (cur.text() == text_ && cur.pos() == it->pos) {
                // non-editable inset, set cursor after the inset if x is
                // nearer to that position (bug 9628)
                bool bound = false; // is modified by getPosNearX