I finally managed to find the real reason for bug 3143. The problem
was a seemingly gratuitous change in 
  http://www.lyx.org/trac/changeset/16433
(the model/view separation of paragraph/lyxtext):

        // This check is necessary. Otherwise the new empty paragraph will
        // be deleted automatically. And it is more friendly for the user!
        if (cur.pos() != 0 || isempty)
-               setCursor(cur, cur.pit() + 1, 0);
+               setCursor(cur.top(), cur.pit() + 1, 0);
        else
-               setCursor(cur, cur.pit(), 0);
+               setCursor(cur.top(), cur.pit(), 0);

It looks the same, but unfortunately the first one calls
SetCurrentFont but the second one does not...

I propose to apply the following patch, even it the difference is not
huge (at least we understand where the bug comes from instead of
adding setCursor here and there).

There are other such changes in the patch, but it is difficult to see
whether they make a difference. Of course a rationalization of these
setCursor methods would make sense...

JMarc

Index: src/text3.C
===================================================================
--- src/text3.C	(révision 17628)
+++ src/text3.C	(copie de travail)
@@ -661,8 +661,6 @@ void LyXText::dispatch(LCursor & cur, Fu
 	case LFUN_BREAK_PARAGRAPH:
 		cap::replaceSelection(cur);
 		breakParagraph(cur, 0);
-		//Reset text style to default
-		setFont(cur, LyXFont(LyXFont::ALL_INHERIT), 0);
 		cur.resetAnchor();
 		bv->switchKeyMap();
 		break;
Index: src/text.C
===================================================================
--- src/text.C	(révision 17628)
+++ src/text.C	(copie de travail)
@@ -653,9 +653,9 @@ void LyXText::breakParagraph(LCursor & c
 	// This check is necessary. Otherwise the new empty paragraph will
 	// be deleted automatically. And it is more friendly for the user!
 	if (cur.pos() != 0 || isempty)
-		setCursor(cur.top(), cur.pit() + 1, 0);
+		setCursor(cur, cur.pit() + 1, 0);
 	else
-		setCursor(cur.top(), cur.pit(), 0);
+		setCursor(cur, cur.pit(), 0);
 }
 
 

Reply via email to