Martin Vermeer wrote:
> Here's the explanation:

Thanks. I still don't fully get it. I understand what you are doing, but I 
don't understand why this is necessary (even though I see *that* it is 
apparently necessary).

> (Actually this is relevant only for positioning *inside* this inset,
> i.e., the case where this cursor slice is not at the tip. Positioning
> the visible cursor in this way is a side effect. Perhaps one should test
> for _not_ being at the tip around the above statements... how?)

Don't know. It would be easy with access to DocIterator :-( But anyway, this 
last positioning problem also applies to nested insets.
However, this is a glitch I think we could live with.

>         if (moved && it < end() && (*it)->getChar())
>
> I believe you can leave out it < end(), as moved == true already implies
> that.

It's even simpler. Cf. the attached.

Jürgen
Index: math_data.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_data.C,v
retrieving revision 1.63
diff -p -u -r1.63 math_data.C
--- math_data.C	26 Apr 2005 11:12:20 -0000	1.63
+++ math_data.C	19 Sep 2005 12:41:49 -0000
@@ -310,6 +310,7 @@ void MathArray::draw(PainterInfo & pi, i
 			}
 		}
 #endif
+		theCoords.insets().add(at.nucleus(), x, y);
 		at->drawSelection(pi, x, y);
 		at->draw(pi, x, y);
 		x += at->width();
@@ -385,10 +386,11 @@ MathArray::size_type MathArray::x2pos(in
 		--it;
 	// The below code guarantees that in this slice, the cursor will
 	// never be on the right edge of an inset after a mouse click.
-	if (it != begin())
+	if (it != begin()) {
 		--it;
-	if (it < end() && (*it)->getChar())
-		++it;
+		if (it < end() && (*it)->getChar())
+			++it;
+	}
 
 	return it - begin();
 }

Reply via email to