I finally got too annoyed by the current behaviour when inserting a
collapsable over a selection.

As it is now, when you select some paragraphs from an itemize list and
insert a branch, the first paragraph is reset to Standard, and the branch
itself is in an itemize list. The new approach is to keep the layout of the
inner first paragraph and reset the outer paragraph to Standard, if the
selection spans multiple paragraphs. If not (i.e. for inline selections),
the inset content is still reset to Standard. This strikes me the correct
behaviour.

We already have this new behaviour in trunk, so this is basically a
backport.

OK?

Jürgen
Index: src/Text3.cpp
===================================================================
--- src/Text3.cpp	(Revision 23464)
+++ src/Text3.cpp	(Arbeitskopie)
@@ -281,13 +281,21 @@
 		// metrics might be invalid at this point (bug 4502)
 		cur.bv().updateMetrics();
 		lyx::dispatch(FuncRequest(LFUN_PASTE, "0"));
-		// reset first par to default
-		if (cur.lastpit() != 0 || cur.lastpos() != 0) {
+		
+		if (cur.lastpit() == 0) {
+			// reset first par to default
 			Layout_ptr const layout =
 				cur.buffer().params().getTextClass().defaultLayout();
 			cur.text()->paragraphs().begin()->layout(layout);
+		} else {
+			// reset surrounding par to default
+			docstring const layoutname = 
+				cur.buffer().params().getTextClass().defaultLayoutName();
+			cur.leaveInset(*inset);
+			text->setLayout(cur, layoutname);
 		}
 	}
+
 	return true;
 }
 

Reply via email to