On Tue, Nov 15, 2005 at 03:36:02PM +0100, Jean-Marc Lasgouttes wrote:
> >>>>> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes:
> 
> Martin> Actually there is a new row created, but it is very small in
> Martin> height (the height of the newlineinset, in fact). Just type in
> Martin> characters and you will see it go up to full height.
> 
> But, looking at InsetNewline::metrics, the height of the newline inset
> should be the height of normal text... We should maybe make sure that
> an empty row has a height equal to font height. How come it works for
> empty paragraphs?
>  
> >> Do you have a good understanding of what the code does? In
> >> particular, there was already code ensuring that lines are broken
> >> after newline insets. What is the interaction with your patch?
> 
> Martin> I think I do. The code that ensures that lines are broken
> Martin> after newline is here:
> [...]
> 
> I see. Didn't you forget a setHeightOfRow?
> 
> JMarc

I forgot even more. Attached a better version. Hit it hard.

(Found one glitch already: with a newline at end of paragraph, the cursor
may get stuck and refuse to go up. It's not a good idea to have a
newline at end paragraph :-)

- Martin

Index: text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.634
diff -u -p -r1.634 text.C
--- text.C      7 Nov 2005 15:02:08 -0000       1.634
+++ text.C      15 Nov 2005 17:42:53 -0000
@@ -1716,6 +1716,17 @@ bool LyXText::redoParagraph(pit_type con
                z = row.endpos();
        } while (z < par.size());
 
+       // Make sure that if a par ends in newline, there is one more row
+       // under it
+       if (z > 0 && par.isNewline(z - 1)) {
+               Row row(z - 1);
+               row.endpos(z - 1);
+               setRowWidth(pit, row);
+               setHeightOfRow(pit, row);
+               par.rows().push_back(row);
+               dim.des += row.height();
+       }
+           
        dim.asc += par.rows()[0].ascent();
        dim.des -= par.rows()[0].ascent();
 

Attachment: pgpjjkWu4QJTp.pgp
Description: PGP signature

Reply via email to