On Tue, Mar 05, 2002 at 11:56:10AM +0100, Juergen Vigna wrote: > On 04-Mar-2002 Martin Vermeer wrote: > > > Good luck (I mean it.) In the meantime, find attached the simple version > > of the patch, which fixes the bug and does nothing more. > > I don't think there is luck involved. Anyway have a look at the fix I > just comitted if you're interested. > > Jug
Yes, this works for me. It does approximately what my first patch also did and looks similarly ugly :-) But I like the trick of making *par the previous of the first paragraph! And you prevent "double deepenings" from appearing, using the useful routine getMaxDepthAfter. I hadn't thought that far yet. One thing I don't quite like, or find elegant, in your patch is the way you handle the case where a depth-delta'd paragraph in the buffer acquires a negative depth. Apparently you just switch off depth-deltaing at that point! Obviously you are going to lose something if you try to "graft" a nested-lists cut with a shallower end point than the starting point, on a too shallow target point, but... Wouldn't it be better this way: // set the right depth so that we are not too deep or shallow. if ((static_cast<int>(tmpbuf->params().depth()) + depth_delta) < 0) tmpbuf->params().depth(tmpbuf->params().depth()); else tmpbuf->params().depth(tmpbuf->params().depth() + depth_delta); or even (switching my optimizer on): // set the right depth so that we are not too deep or shallow. if ((static_cast<int>(tmpbuf->params().depth()) + depth_delta) >= 0) tmpbuf->params().depth(tmpbuf->params().depth() + depth_delta); This way depth_delta is remembered for if the outline goes deeper again later on. Only the too shallow paragraphs are flattened. Martin
msg33953/pgp00000.pgp
Description: PGP signature