On Mon, Mar 04, 2002 at 03:44:08PM +0100, Juergen Vigna wrote:
 
> 
> On 04-Mar-2002 Martin Vermeer wrote:
> 
> > This one fixes Michael Schmitt's 'no hook' bug in copy/pasting enumerates. 
> 
> The idea is good the realization not. I looked into the patch and it seems
> something strange to me, does it really work? Anyway I don't think we like
> this solution. If noone else, I will have a look at this soon and fix it
> with help of the new functions Jean-Marc made for us.
> 
>           Jug

Good luck (I mean it.) In the meantime, find attached the simple version
of the patch, which fixes the bug and does nothing more.

The problem with the first patch (it works all right, why wouldn't it?) 
is that it tries to do what Jean-Marc had in mind (translating a patch 
of enumerate with env depths etc. to the new location where it is 
pasted including its env depth.) The patch does that, but there are 
problems, to note:

- If cutting behind the label, the first paragraph of the past buffer 
  is always converted to standard layout. This messes up the nested 
  list structure below it if there is one. You may even see double env
  depth indents appear -- not disastrous and LaTeX processes it, but
  less than elegant.

- What if you cut out a piece of nested list structure with the end
  point "shallower" than the beginning point? The tail of the structure
  will be flattened.
  
I have a feeling that you with Jean-Marc's routines will not be able to
do better, because of this, which is a fundamental problem. Prove me 
wrong and make me happy ;-) I suspect that the whole idea is 
questionable. And anyway, it's a feature idea, not a bug fix :-)

Martin

Index: CutAndPaste.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/CutAndPaste.C,v
retrieving revision 1.50
diff -u -p -r1.50 CutAndPaste.C
--- CutAndPaste.C       2002/03/02 16:39:44     1.50
+++ CutAndPaste.C       2002/03/04 18:45:18
@@ -21,6 +21,7 @@
 #include "gettext.h"
 #include "iterators.h"
 #include "lyxtextclasslist.h"
+#include "ParagraphParameters.h"
 
 #include "insets/inseterror.h"
 
@@ -267,9 +268,11 @@ bool CutAndPaste::pasteSelection(Paragra
                        tmpbuf2 = tmpbuf2->next();
                }
 
+               tmpbuf = buf;
+               // Force first paragraph env depth to zero:
+               tmpbuf->params().depth(0);
                // now remove all out of the buffer which is NOT allowed in the
                // new environment and set also another font if that is required
-               tmpbuf = buf;
                while(tmpbuf) {
                        // set the inset owner of this paragraph
                        tmpbuf->setInsetOwner((*par)->inInset());

Attachment: msg33944/pgp00000.pgp
Description: PGP signature

Reply via email to