]> git.lyx.org Git - lyx.git/blobdiff - src/TextMetrics.cpp
Add support for todonotes package
[lyx.git] / src / TextMetrics.cpp
index 0e16ab42b034ea1457d7977323f32b91e3692b7a..eb71f74f1c00088fb1268eee64ce064c44022ff8 100644 (file)
@@ -506,11 +506,11 @@ bool TextMetrics::redoParagraph(pit_type const pit)
 }
 
 
-int TextMetrics::getAlign(Paragraph const & par, pos_type const pos) const
+LyXAlignment TextMetrics::getAlign(Paragraph const & par, pos_type const pos) const
 {
        Layout const & layout = par.layout();
 
-       int align;
+       LyXAlignment align;
        if (par.params().align() == LYX_ALIGN_LAYOUT)
                align = layout.align;
        else
@@ -630,6 +630,12 @@ void TextMetrics::computeRowMetrics(pit_type const pit,
                        row.dimension().wid = width - int(w / 2);
                        row.x += w / 2;
                        break;
+               case LYX_ALIGN_LEFT:
+               case LYX_ALIGN_NONE:
+               case LYX_ALIGN_LAYOUT:
+               case LYX_ALIGN_SPECIAL:
+               case LYX_ALIGN_DECIMAL:
+                       break;
                }
        }
 
@@ -1144,12 +1150,14 @@ pos_type TextMetrics::getPosNearX(Row const & row, int & x,
        }
 
        /** This tests for the case where the cursor is set at the end
-        * of a row which has been broken due to a display inset on
-        * next row. This is indicated by Row::right_boundary.
+        * of a row which has been broken due something else than a
+        * separator (a display inset or a forced breaking of the
+        * row). We know that there is a separator when the end of the
+        * row is larger than the end of its last element.
         */
        if (!row.empty() && pos == row.back().endpos
            && row.back().endpos == row.endpos())
-               boundary = row.right_boundary();
+               boundary = true;
 
        x += xo;
        return pos;