Bug 1965: Cursor movement at RtL paragraph end broken
Bug 1970: Selecting an area within one row broken in RtL

Both are fixed by the attached patch, bug 1970 trivially.

I added these to Bugzilla, and also

Bug 1969: Sectioning and enumerate labels are not RtL in Hebrew

for which a patch was posted earlier.


Lars, I agree in principle that features that go stale for lack of
active supporters should be disabled... but I think this kind of
national identity stuff is an exception. We should really, _really_ try
hard to continue to support even small and/or "difficult" ethnic groups.
This is supposed to be one of the strong points of free software, OK?


Also, you can verify by code inspection or testing (I did both) that all
proposed patches are neutral for ordinary LtR text, so we won't lose
anything by just putting it in. I would very much appreciate a second
opinion though.

- Martin

Index: text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.623
diff -u -p -r1.623 text.C
--- text.C	1 Aug 2005 12:37:25 -0000	1.623
+++ text.C	8 Aug 2005 21:17:58 -0000
@@ -1898,12 +1898,13 @@ void LyXText::drawSelection(PainterInfo 
 		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 &
 	
 	// 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);
 }

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to