On Mon, Mar 04, 2002 at 01:52:44PM +0100, Lars Gullik Bjønnes wrote:
> >> And what bug# did this fix?
> >
> | None. Guess I've just got used to submitting patches recently. Apologies.
> 
> Very well.
> 
> I want all patches that we apply to fix a problem. (and not even any
> problem, it must be a problem that is important for 1.2.0)
> 
> For every patch I see that is just applied that does not do this, I am
> more and more inclined to just bar you (all of you) from commiting
> patches at all.
> 
> (and yes, I know that I am a bit hypocritical)

Which is okay if you know what you're doing.
 
> -- 
>       Lgb
 
Okay, mea culpa. Here is one that does fix a bug -- though not in a 
way that I am proud of or happy with. It is less than elegant ;-)

This one fixes Michael Schmitt's 'no hook' bug in copy/pasting enumerates. 

2002-03-04      Martin Vermeer <[EMAIL PROTECTED]>

        * CutAndPaste.C: fix 'no hook' bug, by guaranteeing that the first
        paragraph in the paste buffer is always on environment depth 0 --
        and the others raised to match. Upon patch, the whole shebang is
        again lowered to the env depth of the insert point.
        JMarc's inspiration.


Attached.

Martin

BTW the other patch did fix something: having the '^' symbol in a way
that can be saved and loaded and rendered in LaTeX. No, it was not a 
crasher. And yes, the rest was UI tinkering. Sorry!

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 14:03:38
@@ -21,6 +21,7 @@
 #include "gettext.h"
 #include "iterators.h"
 #include "lyxtextclasslist.h"
+#include "ParagraphParameters.h"
 
 #include "insets/inseterror.h"
 
@@ -267,6 +268,17 @@ bool CutAndPaste::pasteSelection(Paragra
                        tmpbuf2 = tmpbuf2->next();
                }
 
+               tmpbuf = buf;
+               Paragraph::depth_type depth_change;
+               Paragraph::depth_type depth;
+               // "raise" the whole selection buffer to zero env depth 
+               // for the starting paragraph:
+               depth_change = tmpbuf->params().depth();
+               while (tmpbuf) {
+                       depth = tmpbuf->params().depth();
+                       if (depth >= depth_change) tmpbuf->params().depth(depth - 
+depth_change);
+                       tmpbuf = tmpbuf->next();
+               }
                // 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;
@@ -291,7 +303,16 @@ bool CutAndPaste::pasteSelection(Paragra
                        }
                        tmpbuf = tmpbuf->next();
                }
-               
+
+               tmpbuf = buf;
+               // "Sink" the whole selection buffer to the env depth of insertion 
+point:
+               depth_change = (*par)->params().depth();
+               while (tmpbuf) {
+                       depth = tmpbuf->params().depth();
+                       tmpbuf->params().depth(depth + depth_change);
+                       tmpbuf = tmpbuf->next();
+               }
+       
                // make sure there is no class difference
                SwitchLayoutsBetweenClasses(textclass, tc, buf,
                                            current_view->buffer()->params);

Attachment: msg33913/pgp00000.pgp
Description: PGP signature

Reply via email to