> So I wonder if this was the right approach - or would a special
> case in pasting be better?  
 
...
 
> I wonder if this was the right approach - or would a special
> case in pasting be better?
> 
> Helge Hafting
 
Attached the special-casing solution. You were right, even if special
casing is generally frowned upon as it convolutes the logic and is not
OO. But I don't have to tell you which one I prefer :-)

- Martin
 
Index: math_nestinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_nestinset.C,v
retrieving revision 1.151
diff -u -r1.151 math_nestinset.C
--- math_nestinset.C    10 Apr 2005 09:07:28 -0000      1.151
+++ math_nestinset.C    10 Apr 2005 21:17:43 -0000
@@ -811,8 +811,11 @@
                recordUndo(cur, Undo::ATOMIC);
                MathArray ar;
                asArray(cmd.argument, ar);
+               int cell(0);
+               if (cmd.argument == "\\root")
+                       cell = 1;
                if (ar.size() == 1 && (ar[0].nucleus()->asNestInset())) {
-                       cur.handleNest(ar[0]);
+                       cur.handleNest(ar[0], cell);
                } else
                        cur.niceInsert(cmd.argument);
                break;

Attachment: pgpn3DgzpBFR5.pgp
Description: PGP signature

Reply via email to