]> git.lyx.org Git - lyx.git/commitdiff
Fix bidi bugs 1965, 1970
authorMartin Vermeer <martin.vermeer@hut.fi>
Mon, 15 Aug 2005 08:26:53 +0000 (08:26 +0000)
committerMartin Vermeer <martin.vermeer@hut.fi>
Mon, 15 Aug 2005 08:26:53 +0000 (08:26 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10396 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/text.C

index 47f2ebfe498d8416bf9f843c2b401611fb9eb4d4..d704fad9dab6ab83c5873484ee7624e1ac3282a8 100644 (file)
@@ -1,3 +1,11 @@
+
+2005-08-02  Martin Vermeer  <martin.vermeer@hut.fi>
+
+       * text.C (cursorX): fix bug 1965: cursor movement at
+       line end broken in RtL.
+       (drawSelection): fix bug 1970: drawing of single-line 
+       selection broken for RtL.
+
 2005-07-31  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
        bug 465.
index 95e8dccc9d5b4de611058517c535b78790cc6b5d..8726bed96b9896b2679d774e4983e77e15783271 100644 (file)
@@ -1898,12 +1898,13 @@ void LyXText::drawSelection(PainterInfo & pi, int x, int) const
                X2 = !isRTL(par2) ? endx : 0 + dim_.wid;
        }
 
-       if (!above && !below && &par1.getRow(beg.pos(), end.boundary())
+       if (!above && !below && &par1.getRow(beg.pos(), beg.boundary())
            == &par2.getRow(end.pos(), end.boundary()))
        {
                // paint only one rectangle
-               pi.pain.fillRectangle(x + x1, y1, X2 - x1, y2 - y1,
-                                     LColor::selection);
+               int const b( !isRTL(par1) ? x + x1 : x + X1 );
+               int const w( !isRTL(par1) ? X2 - x1 : x2 - X1 );
+               pi.pain.fillRectangle(b, y1, w, y2 - y1, LColor::selection);
                return;
        }
 
@@ -2129,7 +2130,10 @@ int LyXText::cursorX(CursorSlice const & sl, bool boundary) const
        
        // see correction above
        if (boundary_correction)
-               x += singleWidth(par, ppos);
+               if (getFont(par, ppos).isRightToLeft())
+                       x -= singleWidth(par, ppos);
+               else
+                       x += singleWidth(par, ppos);
 
        return int(x);
 }