]> git.lyx.org Git - lyx.git/blobdiff - src/TextMetrics.cpp
Add missing revert routine to lyx_2_0.py
[lyx.git] / src / TextMetrics.cpp
index 19a5e8f1476fa91e112ee918c2adc6677ce83d3d..f58efa794beeee18760483f49f2cb402f745a4f2 100644 (file)
@@ -916,10 +916,10 @@ Row TextMetrics::tokenizeParagraph(pit_type const pit) const
                        // ⤶ U+2936 ARROW POINTING DOWNWARDS THEN CURVING LEFTWARDS
                        // ¶ U+00B6 PILCROW SIGN
                        char_type const screen_char = (c == 0x2028) ? 0x2936 : 0x00B6;
-                       row.add(i, screen_char, *fi, par.lookupChange(i), i >= body_pos);
+                       row.add(i, screen_char, *fi, par.lookupChange(i));
                } else
                        // row elements before body are unbreakable
-                       row.add(i, c, *fi, par.lookupChange(i), i >= body_pos);
+                       row.add(i, c, *fi, par.lookupChange(i));
 
                // add inline completion width
                // draw logically behind the previous character
@@ -979,7 +979,7 @@ class flexible_const_iterator {
 public:
 
        //
-       flexible_const_iterator operator++() {
+       flexible_const_iterator operator++() {
                if (pile_.empty())
                        ++cit_;
                else
@@ -1059,7 +1059,7 @@ void cleanupRow(Row & row, bool at_end)
        if (!at_end && !row.flushed())
                row.back().rtrim();
        // boundary exists when there was no space at the end of row
-       row.right_boundary(!at_end && row.back().endpos == row.endpos());
+       row.end_boundary(!at_end && row.back().endpos == row.endpos());
        // make sure that the RTL elements are in reverse ordering
        row.reverseRTL();
 }
@@ -1202,7 +1202,10 @@ int TextMetrics::parTopSpacing(pit_type const pit) const
            && prevpar.getLabelWidthString() == par.getLabelWidthString()) {
                layoutasc = layout.itemsep * dh;
        } else if (pit != 0 && layout.topsep > 0)
-               layoutasc = layout.topsep * dh;
+               // combine the separation between different layouts (with same depth)
+               layoutasc = max(0.0,
+                       prevpar.getDepth() != par.getDepth() ? layout.topsep
+                       : layout.topsep - prevpar.layout().bottomsep) * dh;
 
        asc += int(layoutasc * 2 / (2 + pars[pit].getDepth()));
 
@@ -1365,7 +1368,7 @@ pos_type TextMetrics::getPosNearX(Row const & row, int & x,
                              || inset->lyxCode() == SEPARATOR_CODE))
                        pos = row.back().pos;
                else
-                       boundary = row.right_boundary();
+                       boundary = row.end_boundary();
        }
 
        x += xo - offset;