]> git.lyx.org Git - lyx.git/blobdiff - src/text.C
layout file converter for layout files in old format
[lyx.git] / src / text.C
index 9f898a515a931fb331d801883bd84d44c347a293..4603d9a2f9fc051e17500919bf1d5b9651541dfd 100644 (file)
@@ -1002,7 +1002,8 @@ void LyXText::setHeightOfRow(pit_type const pit, Row & row)
        if (bv_owner->text() == this) {
                if (pit == 0 && row.pos() == 0)
                        maxasc += 20;
-               if (pit + 1 == pars_.size() && row.endpos() == par.size())
+               if (pit + 1 == pit_type(pars_.size()) &&
+                   row.endpos() == par.size())
                        maxdesc += 20;
        }
 
@@ -2127,11 +2128,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);
 }
 
@@ -2306,7 +2315,7 @@ pos_type LyXText::x2pos(pit_type pit, int row, int x) const
 
 // x,y are screen coordinates
 // sets cursor only within this LyXText
-void LyXText::setCursorFromCoordinates(LCursor & cur, int const x, int const y)
+bool LyXText::setCursorFromCoordinates(LCursor & cur, int const x, int const y)
 {
        pit_type pit = getPitNearY(y);
        int yy = theCoords.get(this, pit).y_ - pars_[pit].ascent();
@@ -2345,5 +2354,5 @@ void LyXText::setCursorFromCoordinates(LCursor & cur, int const x, int const y)
                 << " pos: " << pos
                 << endl;
         
-       setCursor(cur, pit, pos, true, bound);
+       return setCursor(cur, pit, pos, true, bound);
 }