rowLast was broken: we'd often return -1. Other code was not prepared
for this, and it only worked by accident. My changes tickled this bug,
so I had to fix it.


Index: src/text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.283
diff -u -r1.283 text.C
--- src/text.C  27 Dec 2002 11:08:08 -0000      1.283
+++ src/text.C  7 Feb 2003 11:32:07 -0000
@@ -245,6 +250,9 @@
 // Returns the paragraph position of the last character in the specified row
 pos_type LyXText::rowLast(Row const * row) const
 {
+       if (!row->par()->size())
+               return 0;
+ 
        if (!row->next() || row->next()->par() != row->par()) {
                return row->par()->size() - 1;
        } else {
@@ -260,8 +268,8 @@
        Inset * ins;
        // we have to consider a space on the last position in this case!
        if (row->next() && row->par() == row->next()->par() &&
-           row->next()->par()->getChar(last+1) == Paragraph::META_INSET &&
-           (ins=row->next()->par()->getInset(last+1)) &&
+           row->next()->par()->getChar(last + 1) == Paragraph::META_INSET &&
+           (ins=row->next()->par()->getInset(last + 1)) &&
            (ins->needFullRow() || ins->display()))
        {
                ignore_the_space_on_the_last_position = false;

Reply via email to