Martin Vermeer wrote:
On Fri, Oct 12, 2007 at 09:11:40PM -0700, Angus Leeming wrote:
 [EMAIL PROTECTED] wrote:
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/Text3.cpp?rev=20898
==============================================================================
--- lyx-devel/trunk/src/Text3.cpp (original)
+++ lyx-devel/trunk/src/Text3.cpp Thu Oct 11 12:13:45 2007
@@ -210,8 +210,8 @@
                if (gotsel && pastesel) {
                        lyx::dispatch(FuncRequest(LFUN_PASTE, "0"));
-                       InsetLayout il = 
inset->getLayout(cur.buffer().params());
-                       if (!il.multipar || cur.lastpit() == 0) {
+                       if (!static_cast<InsetText *>(inset)->allowMultiPar()
 Two questions:
1. Why add an allowMultiPar member to InsetCollapsable if you're not going to use it (or does InsetCollapsable now derive from InsetText?).

It does (and that's the idea). Collapsable loads this info from the layout file.

2. Are you guaranteed to have an InsetText inset here? The code would be safer as:
     InsetText * insetText = dynamic_cast<InsetText *>(inset);
     if (insetText && insetText->allowMultiPar())

Probably wise, thanks. (But what inset is not InsetText-derived
yet allows pasting into?)

The 'LyX' way to avoid dynamic cast is to use asInsetText(). Dynamic casts are nice but they are slow on with some compiler whereas asInsetText() is fast, even if not pretty...

Abdel.

Reply via email to