]> git.lyx.org Git - lyx.git/blobdiff - src/text.C
Two fixes involving RtL text drawing
[lyx.git] / src / text.C
index ddd41bbe46c1fc24c78dca944228eb34393d63fc..6536f40233481cdf4a3a4a4e7680435acf08d451 100644 (file)
@@ -70,6 +70,8 @@
 #include "support/textutils.h"
 #include "support/convert.h"
 
+#include <boost/current_function.hpp>
+
 #include <sstream>
 
 using lyx::pit_type;
@@ -1692,7 +1694,7 @@ bool LyXText::redoParagraph(pit_type const pit)
        InsetList::iterator iend = par.insetlist.end();
        for (; ii != iend; ++ii) {
                Dimension dim;
-               int const w = maxwidth_ - leftMargin(pit) - rightMargin(par);
+               int const w = maxwidth_ - leftMargin(pit, ii->pos) - rightMargin(par);
                MetricsInfo mi(bv(), getFont(par, ii->pos), w);
                ii->inset->metrics(mi, dim);
        }
@@ -2125,11 +2127,19 @@ int LyXText::cursorX(CursorSlice const & sl, bool boundary) const
        
        // see correction above
        if (boundary_correction)
-               if (getFont(par, ppos).isRightToLeft())
+               if (getFont(par, ppos).isVisibleRightToLeft())
                        x -= singleWidth(par, ppos);
                else
                        x += singleWidth(par, ppos);
 
+       // Make sure inside an inset we always count from the left
+       // edge (bidi!) -- MV
+       if (sl.pos() < par.size()) {
+               font = getFont(par, sl.pos());
+               if (!boundary && font.isVisibleRightToLeft()
+                 && par.isInset(sl.pos()))
+                       x -= par.getInset(sl.pos())->width();
+       }       
        return int(x);
 }