John Levon wrote:

> It doesn't eliminate any special casing surely. If you think it does I'd
> be happy to see a patch ...


Ok, I did some research:

There is a couple more of them that seem to assume that a par won't be empty
after a breakAgain or breakAgainOneRow. I don't know if that is right or if
it can fragile.

Didn't look at insettext.C yet.

Alfredo


text2.C (959):

void LyXText::cursorEnd()
{
        if (!cursor.row()->next()
            || cursor.row()->next()->par() != cursor.row()->par()) {
                setCursor(cursor.par(), cursor.row()->lastPos() + 1);
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                        missing casing
        } else {
                if (!cursor.par()->empty() &&
                    (cursor.par()->getChar(cursor.row()->lastPos()) == ' '
                     || cursor.par()->isNewline(cursor.row()->lastPos()))) {
                        setCursor(cursor.par(), cursor.row()->lastPos());
                } else {
                        setCursor(cursor.par(),
                                  cursor.row()->lastPos() + 1);
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                missing casing
                }
        }
}

text.C (1048):

        pos_type const pos_end = row->lastPos();
        int labeladdon = 0;
        int maxwidth = 0;
        if (!row->par()->empty()) {
        ^^^^^^^^^^^^^^^^^^^^^^^^^ eliminable casing
                // Check if any insets are larger
                for (pos_type pos = row->pos(); pos <= pos_end; ++pos) {

text.C (1075):

        // Check if any custom fonts are larger (Asger)
        // This is not completely correct, but we can live with the small,
        // cosmetic error for now.
        LyXFont::FONT_SIZE maxsize =
                row->par()->highestFontInRange(row->pos(), pos_end, size);

not sure about this one... if the par has 1 char, pos_end gives 0. shouldn't
this pos_end be pos_end + 1 (and then a casing is missing)? Or else we
access an invalid position on highestFontInRange? I.e: is the range in
highestFontInRange a 'char positions' range or a 'cursor positions' range?


text.C (355):

        bidi_start = row->pos();
        bidi_end = row->lastPrintablePos();

        if (bidi_start > bidi_end) {
        ^^^^^^^^^^^^^^^^^^^^^^^^^^ 
        mising casing
                bidi_start = -1;
                return;
        }

text.C (913):
        // get the pure distance
        pos_type const last = row.lastPrintablePos();

        // special handling of the right address boxes
        if (row.par()->layout()->margintype == MARGIN_RIGHT_ADDRESS_BOX) {
                int const tmpfill = row.fill();
                row.fill(0); // the minfill in MarginLeft()
                w = leftMargin(&row);
                row.fill(tmpfill);
        } else
                w = leftMargin(&row);

        Paragraph * par = row.par();
        LyXLayout_ptr const & layout = par->layout();

        pos_type const body_pos = par->beginningOfBody();
        pos_type i = row.pos();

        while (i <= last) {
        ^^^^^^^^^^^^^^^^^^^^^
        mising casing

                if (body_pos > 0 && i == body_pos) {
                        w += font_metrics::width(layout->labelsep, 
getLabelFont(bv()->buffer(),
par));




Reply via email to