The problem was that the code in LyXText::cursorX did not notice that 
the font changes between the description label and its main text, and
thus used the bold font metrics.

The solution is to make sure that a FontSpan does not span across
beginOfBody.

Comments?

JMarc

Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.2317
diff -u -p -r1.2317 ChangeLog
--- src/ChangeLog	3 Nov 2005 10:49:31 -0000	1.2317
+++ src/ChangeLog	3 Nov 2005 10:54:13 -0000
@@ -1,3 +1,8 @@
+2005-11-03  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* paragraph.C (fontSpan): make sure that the FontSpan does not
+	span across beginOfBody (bug 1947).
+
 2005-11-02  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
 	* lyxlength.h: undefine macros that clash with solaris/x86 (bug 992)
Index: src/paragraph.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v
retrieving revision 1.414
diff -u -p -r1.414 paragraph.C
--- src/paragraph.C	9 Sep 2005 11:04:52 -0000	1.414
+++ src/paragraph.C	3 Nov 2005 10:54:13 -0000
@@ -48,6 +48,7 @@
 #include <boost/tuple/tuple.hpp>
 #include <boost/bind.hpp>
 
+#include <algorithm>
 #include <list>
 #include <stack>
 #include <sstream>
@@ -333,8 +334,15 @@ FontSpan Paragraph::fontSpan(lyx::pos_ty
 	Pimpl::FontList::const_iterator cit = pimpl_->fontlist.begin();
 	Pimpl::FontList::const_iterator end = pimpl_->fontlist.end();
 	for (; cit != end; ++cit) {
-		if (cit->pos() >= pos)
-			return FontSpan(start, cit->pos());
+		if (cit->pos() >= pos) {
+			if (pos >= beginOfBody())
+				return FontSpan(std::max(start, beginOfBody()),
+						cit->pos());
+			else
+				return FontSpan(start, 
+						std::min(beginOfBody() - 1, 
+							 cit->pos()));
+		}
 		start = cit->pos() + 1;
 	}
 

Reply via email to