Index: src/insets/InsetCaption.cpp
===================================================================
--- src/insets/InsetCaption.cpp	(Revision 18581)
+++ src/insets/InsetCaption.cpp	(Arbeitskopie)
@@ -97,9 +97,9 @@
 
 
 void InsetCaption::cursorPos(BufferView const & bv,
-		CursorSlice const & sl, bool boundary, int & x, int & y) const
+		CursorSlice const & sl, bool boundary, int & x, int & y, bool & rtl) const
 {
-	InsetText::cursorPos(bv, sl, boundary, x, y);
+	InsetText::cursorPos(bv, sl, boundary, x, y, rtl);
 	x += labelwidth_;
 }
 
Index: src/insets/InsetTabular.h
===================================================================
--- src/insets/InsetTabular.h	(Revision 18581)
+++ src/insets/InsetTabular.h	(Arbeitskopie)
@@ -713,7 +713,7 @@
 	Code lyxCode() const { return Inset::TABULAR_CODE; }
 	/// get offset of this cursor slice relative to our upper left corner
 	void cursorPos(BufferView const & bv, CursorSlice const & sl,
-		bool boundary, int & x, int & y) const;
+		bool boundary, int & x, int & y, bool & rtl) const;
 	///
 	bool tabularFeatures(Cursor & cur, std::string const & what);
 	///
Index: src/insets/Inset.cpp
===================================================================
--- src/insets/Inset.cpp	(Revision 18581)
+++ src/insets/Inset.cpp	(Arbeitskopie)
@@ -270,7 +270,7 @@
 
 
 void Inset::cursorPos(BufferView const & /*bv*/, CursorSlice const &,
-		bool, int & x, int & y) const
+		bool, int & x, int & y, bool & rtl) const
 {
 	lyxerr << "Inset::cursorPos called directly" << std::endl;
 	x = 100;
Index: src/insets/InsetTabular.cpp
===================================================================
--- src/insets/InsetTabular.cpp	(Revision 18581)
+++ src/insets/InsetTabular.cpp	(Arbeitskopie)
@@ -3856,9 +3856,9 @@
 
 
 void InsetTabular::cursorPos(BufferView const & bv,
-		CursorSlice const & sl, bool boundary, int & x, int & y) const
+		CursorSlice const & sl, bool boundary, int & x, int & y, bool & rtl) const
 {
-	cell(sl.idx())->cursorPos(bv, sl, boundary, x, y);
+	cell(sl.idx())->cursorPos(bv, sl, boundary, x, y, rtl);
 
 	// y offset	correction
 	int const row = tabular.row_of_cell(sl.idx());
Index: src/insets/InsetCaption.h
===================================================================
--- src/insets/InsetCaption.h	(Revision 18581)
+++ src/insets/InsetCaption.h	(Arbeitskopie)
@@ -41,7 +41,7 @@
 	virtual docstring const editMessage() const;
 	///
 	virtual void cursorPos(BufferView const & bv,
-		CursorSlice const & sl, bool boundary, int & x, int & y) const;
+		CursorSlice const & sl, bool boundary, int & x, int & y, bool & rtl) const;
 	///
 	bool descendable() const { return true; }
 	///
Index: src/insets/Inset.h
===================================================================
--- src/insets/Inset.h	(Revision 18581)
+++ src/insets/Inset.h	(Arbeitskopie)
@@ -146,8 +146,10 @@
 	/// do we cover screen position x/y?
 	virtual bool covers(BufferView const & bv, int x, int y) const;
 	/// get the screen positions of the cursor (see note in Cursor.cpp)
+	/// rtl == true if x is the right side (or left for boundary == true)
+	/// of an inset placed at the cursor
 	virtual void cursorPos(BufferView const & bv,
-		CursorSlice const & sl, bool boundary, int & x, int & y) const;
+		CursorSlice const & sl, bool boundary, int & x, int & y, bool & rtl) const;
 
 	/// is this an inset that can be moved into?
 	virtual bool isActive() const { return nargs() > 0; }
Index: src/insets/InsetCollapsable.cpp
===================================================================
--- src/insets/InsetCollapsable.cpp	(Revision 18581)
+++ src/insets/InsetCollapsable.cpp	(Arbeitskopie)
@@ -240,11 +240,11 @@
 
 
 void InsetCollapsable::cursorPos(BufferView const & bv,
-		CursorSlice const & sl, bool boundary, int & x, int & y) const
+		CursorSlice const & sl, bool boundary, int & x, int & y, bool & rtl) const
 {
 	BOOST_ASSERT(status() != Collapsed);
 
-	InsetText::cursorPos(bv, sl, boundary, x, y);
+	InsetText::cursorPos(bv, sl, boundary, x, y, rtl);
 
 	if (status() == Open) {
 		if (openinlined_)
Index: src/insets/InsetText.h
===================================================================
--- src/insets/InsetText.h	(Revision 18581)
+++ src/insets/InsetText.h	(Arbeitskopie)
@@ -78,7 +78,7 @@
 
 	/// return x,y of given position relative to the inset's baseline
 	void cursorPos(BufferView const & bv, CursorSlice const & sl,
-		bool boundary, int & x, int & y) const;
+		bool boundary, int & x, int & y, bool & rtl) const;
 	///
 	Code lyxCode() const { return TEXT_CODE; }
 	///
Index: src/insets/InsetText.cpp
===================================================================
--- src/insets/InsetText.cpp	(Revision 18581)
+++ src/insets/InsetText.cpp	(Arbeitskopie)
@@ -344,10 +344,11 @@
 
 
 void InsetText::cursorPos(BufferView const & bv,
-		CursorSlice const & sl, bool boundary, int & x, int & y) const
+		CursorSlice const & sl, bool boundary, int & x, int & y, bool & rtl) const
 {
 	x = text_.cursorX(bv, sl, boundary) + border_;
 	y = text_.cursorY(bv, sl, boundary);
+	rtl = text_.isRTL(*bv.buffer(), sl.pit(), sl.pos(), boundary);
 }
 
 
Index: src/insets/InsetCollapsable.h
===================================================================
--- src/insets/InsetCollapsable.h	(Revision 18581)
+++ src/insets/InsetCollapsable.h	(Arbeitskopie)
@@ -57,7 +57,7 @@
 	void drawSelection(PainterInfo & pi, int x, int y) const;
 	/// return x,y of given position relative to the inset's baseline
 	void cursorPos(BufferView const & bv, CursorSlice const & sl,
-		bool boundary, int & x, int & y) const;
+		bool boundary, int & x, int & y, bool & rtl) const;
 	///
 	bool hitButton(FuncRequest const &) const;
 	///
Index: src/Text2.cpp
===================================================================
--- src/Text2.cpp	(Revision 18581)
+++ src/Text2.cpp	(Arbeitskopie)
@@ -1030,8 +1030,9 @@
 
 	// not at paragraph end?
 	if (cur.pos() != cur.lastpos()) {
-		// if left of boundary -> just jump to right side 
-		if (cur.boundary())
+		// if left of boundary -> just jump to right side
+	  // but for RTL boundaries don't, because: abc|DDEEFFghi -> abcDDEEF|Fghi
+	  if (cur.boundary() && !bidi.isBoundary(cur.buffer(), cur.paragraph(), cur.pos()))
 			return setCursor(cur, cur.pit(), cur.pos(), true, false);
 
 		// in front of editable inset, i.e. jump into it?
@@ -1062,6 +1063,11 @@
 			return setCursor(cur, cur.pit(), cur.pos() + 1, true, true);
 		}
 		
+		// in front of RTL boundary? Stay on this side of the boundary because:
+		//   ab|cDDEEFFghi -> abc|DDEEFFghi
+		if (bidi.isBoundary(cur.buffer(), cur.paragraph(), cur.pos() + 1))
+			return setCursor(cur, cur.pit(), cur.pos() + 1, true, true);
+		
 		// move right
 		return setCursor(cur, cur.pit(), cur.pos() + 1, true, false);
 	}
Index: src/mathed/InsetMathMBox.h
===================================================================
--- src/mathed/InsetMathMBox.h	(Revision 18581)
+++ src/mathed/InsetMathMBox.h	(Arbeitskopie)
@@ -53,7 +53,7 @@
 	Text * getText(int) const;
 	///
 	void cursorPos(BufferView const & bv, CursorSlice const & sl,
-		bool boundary, int & x, int & y) const;
+		bool boundary, int & x, int & y, bool & rtl) const;
 protected:
 	virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
 
Index: src/mathed/MathMacro.h
===================================================================
--- src/mathed/MathMacro.h	(Revision 18581)
+++ src/mathed/MathMacro.h	(Arbeitskopie)
@@ -40,7 +40,7 @@
 	bool metrics(MetricsInfo & mi, Dimension & dim) const;
 	/// get cursor position
 	void cursorPos(BufferView const & bv, CursorSlice const & sl,
-		bool boundary, int & x, int & y) const;
+		bool boundary, int & x, int & y, bool & rtl) const;
 	///
 	Inset * editXY(Cursor & cur, int x, int y);
 	/// target pos when we enter the inset from the left by pressing "Right"
Index: src/mathed/MathMacro.cpp
===================================================================
--- src/mathed/MathMacro.cpp	(Revision 18581)
+++ src/mathed/MathMacro.cpp	(Arbeitskopie)
@@ -104,11 +104,11 @@
 
 
 void MathMacro::cursorPos(BufferView const & bv,
-		CursorSlice const & sl, bool boundary, int & x,	int & y) const
+		CursorSlice const & sl, bool boundary, int & x,	int & y, bool & rtl) const
 {
 	// We may have 0 arguments, but InsetMathNest requires at least one.
 	if (nargs() > 0)
-		InsetMathNest::cursorPos(bv, sl, boundary, x, y);
+		InsetMathNest::cursorPos(bv, sl, boundary, x, y, rtl);
 }
 
 
Index: src/mathed/InsetMathNest.cpp
===================================================================
--- src/mathed/InsetMathNest.cpp	(Revision 18581)
+++ src/mathed/InsetMathNest.cpp	(Arbeitskopie)
@@ -86,7 +86,7 @@
 
 void InsetMathNest::cursorPos(BufferView const & bv,
 		CursorSlice const & sl, bool /*boundary*/,
-		int & x, int & y) const
+		int & x, int & y, bool & rtl) const
 {
 // FIXME: This is a hack. Ideally, the coord cache should not store
 // absolute positions, but relative ones. This would mean to call
Index: src/mathed/InsetMathNest.h
===================================================================
--- src/mathed/InsetMathNest.h	(Revision 18581)
+++ src/mathed/InsetMathNest.h	(Arbeitskopie)
@@ -44,7 +44,7 @@
 	InsetMathNest const * asNestInset() const { return this; }
 	/// get cursor position
 	void cursorPos(BufferView const & bv, CursorSlice const & sl,
-		bool boundary, int & x, int & y) const;
+		bool boundary, int & x, int & y, bool & rtl) const;
 	///
 	void edit(Cursor & cur, bool left);
 	///
Index: src/mathed/InsetMathMBox.cpp
===================================================================
--- src/mathed/InsetMathMBox.cpp	(Revision 18581)
+++ src/mathed/InsetMathMBox.cpp	(Arbeitskopie)
@@ -117,10 +117,11 @@
 
 
 void InsetMathMBox::cursorPos(BufferView const & bv,
-		CursorSlice const & sl, bool boundary, int & x, int & y) const
+		CursorSlice const & sl, bool boundary, int & x, int & y, bool & rtl) const
 {
 	x = text_.cursorX(bv, sl, boundary);
 	y = text_.cursorY(bv, sl, boundary);
+	rtl = text_.isRTL(*bv.buffer(), sl.pit(), sl.pos(), boundary);
 }
 
 
Index: src/Text.cpp
===================================================================
--- src/Text.cpp	(Revision 18581)
+++ src/Text.cpp	(Arbeitskopie)
@@ -1692,14 +1692,6 @@
 		else
 			x += singleWidth(buffer, par, ppos);
 
-	// Make sure inside an inset we always count from the left
-	// edge (bidi!) -- MV
-	if (sl.pos() < par.size()) {
-		font = getFont(buffer, par, sl.pos());
-		if (!boundary && font.isVisibleRightToLeft()
-		  && par.isInset(sl.pos()))
-			x -= par.getInset(sl.pos())->width();
-	}
 	return int(x);
 }
 
Index: src/Text3.cpp
===================================================================
--- src/Text3.cpp	(Revision 18581)
+++ src/Text3.cpp	(Arbeitskopie)
@@ -299,6 +299,13 @@
 }
 
 
+bool Text::isRTL(Buffer const & buffer, pit_type pit, pos_type pos, bool boundary) const
+{
+	Paragraph const & par = getPar(pit);
+	return getFont(buffer, par, pos).isVisibleRightToLeft();
+}
+
+
 void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 {
 	LYXERR(Debug::ACTION) << "Text::dispatch: cmd: " << cmd << endl;
Index: src/Cursor.cpp
===================================================================
--- src/Cursor.cpp	(Revision 18581)
+++ src/Cursor.cpp	(Arbeitskopie)
@@ -110,9 +110,13 @@
 			}
 
 			Point o = I->second;
-			inset->cursorPos(c.bv(), it.top(), c.boundary(), xo, yo);
+			bool rtl = false;
+			inset->cursorPos(c.bv(), it.top(), c.boundary(), xo, yo, rtl);
 			// Convert to absolute
-			xo += o.x_;
+			if (rtl && it != et)
+				xo += o.x_ - inset->width();
+			else
+				xo += o.x_;
 			yo += o.y_;
 			double d = (x - xo) * (x - xo) + (y - yo) * (y - yo);
 			// '<=' in order to take the last possible position
Index: src/bufferview_funcs.cpp
===================================================================
--- src/bufferview_funcs.cpp	(Revision 18581)
+++ src/bufferview_funcs.cpp	(Arbeitskopie)
@@ -161,15 +161,31 @@
 {
 	int x = 0;
 	int y = 0;
+	int lastw = 0;
 
-	// Contribution of nested insets
-	for (size_t i = 1; i != dit.depth(); ++i) {
+	// Addup ontribution of nested insets, from inside to outside,
+	// keeping the outer paragraph for a special handling below
+	for (size_t i = dit.depth() - 1; i >= 1; --i) {
 		CursorSlice const & sl = dit[i];
 		int xx = 0;
 		int yy = 0;
-		sl.inset().cursorPos(bv, sl, boundary && ((i+1) == dit.depth()), xx, yy);
-		x += xx;
+		
+		// get relative position inside sl.inset()
+		bool rtl = false;
+		sl.inset().cursorPos(bv, sl, boundary && ((i+1) == dit.depth()), xx, yy, rtl);
+		
+		// Make relative position inside of the edited inset relative to sl.inset()
+		x += xx
 		y += yy;
+		
+		// In case of an RTL inset, the edited inset will be positioned to the left
+		// of xx:yy
+		if (rtl)
+			x -= lastw;
+		
+		// remember width for the case that sl.inset() is positioned in an RTL inset
+		lastw = sl.inset().width();
+		
 		//lyxerr << "Cursor::getPos, i: "
 		// << i << " x: " << xx << " y: " << y << endl;
 	}
@@ -180,6 +196,7 @@
 	BOOST_ASSERT(!pm.rows().empty());
 	y -= pm.rows()[0].ascent();
 #if 1
+	// FIXME: document this mess
 	size_t rend;
 	if (sl.pos() > 0 && dit.depth() == 1) {
 		int pos = sl.pos();
@@ -195,8 +212,18 @@
 	for (size_t rit = 0; rit != rend; ++rit)
 		y += pm.rows()[rit].height();
 	y += pm.rows()[rend].ascent();
-	x += dit.bottom().text()->cursorX(bv, dit.bottom(), boundary && dit.depth() == 1);
-
+	
+	// Make relative position from the nested inset now bufferview absolute.
+	int xx = dit.bottom().text()->cursorX(bv, dit.bottom(), boundary && dit.depth() == 1);
+	x += xx;
+	
+	// In the RTL case place the nested inset at the left of the cursor in 
+	// the outer paragraph
+	bool rtl = dit.bottom().text()->isRTL(*bv.buffer(), dit.bottom().pit(), 
+																				dit.bottom().pos(), boundary);
+	if (rtl)
+		x -= lastw;
+	
 	return Point(x, y);
 }
 
Index: src/Text.h
===================================================================
--- src/Text.h	(Revision 18581)
+++ src/Text.h	(Arbeitskopie)
@@ -333,6 +333,8 @@
 	docstring getPossibleLabel(Cursor & cur) const;
 	/// is this paragraph right-to-left?
 	bool isRTL(Buffer const &, Paragraph const & par) const;
+	/// is this position in the paragraph right-to-left?
+	bool isRTL(Buffer const &, pit_type pit, pos_type pos, bool boundary) const;
 	///
 	bool checkAndActivateInset(Cursor & cur, bool front);
 
