lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev [PATCH 2.8.4dev.19] table robustness


From: Ilya Zakharevich
Subject: lynx-dev [PATCH 2.8.4dev.19] table robustness
Date: Wed, 14 Mar 2001 01:58:13 -0500
User-agent: Mutt/1.2.5i

TRST would sometimes produce non-intuitive results if <td> follows
</tr>.  This patch adds error recovery for this case.

Enjoy,
Ilya

--- ./src/TRSTable.c-pre-endtr  Tue Mar 13 04:57:46 2001
+++ ./src/TRSTable.c    Wed Mar 14 01:48:46 2001
@@ -74,6 +74,12 @@ typedef struct _STable_cellinfo {
                                   or RESERVEDCELL */
 } STable_cellinfo;
 
+enum ended_state {
+       ROW_not_ended,
+       ROW_ended_by_endtr,
+       ROW_ended_by_splitline
+};
+
 typedef struct _STable_rowinfo {
     /* Each row may be displayed on many display lines, but we fix up
        positions of cells on this display line only: */
@@ -103,6 +109,7 @@ typedef struct _STable_rowinfo {
        reset to the line of icell_core.
      */
        BOOL    fixed_line;     /* if we have a 'core' line of cells */
+       BOOL    ended;          /* if we saw </tr> */
        int     allocated;      /* number of table cells allocated */
        STable_cellinfo * cells;
        short   alignment;      /* global align attribute for this row */
@@ -1218,6 +1225,7 @@ PUBLIC int Stbl_addRowToTable ARGS3(
        me->pending_colgroup_next = 0;
     }
     me->rows[me->nrows].Line = -1; /* not yet used */
+    me->rows[me->nrows].ended = ROW_not_ended; /* No </tr> yet */
     return (me->nrows - 1);
 }
 
@@ -1236,6 +1244,7 @@ PRIVATE int Stbl_finishRowInTable ARGS1(
        return -1;              /* no row started! */
     lastrow = me->rows + (me->nrows - 1);
     ncells = lastrow->ncells;
+    lastrow->ended = ROW_ended_by_endtr;
     if (lastrow->ncells > 0) {
        if (s->pending_len > 0)
            lastrow->cells[lastrow->ncells - 1].len = s->pending_len;
@@ -1515,6 +1524,8 @@ PUBLIC int Stbl_addCellToTable ARGS7(
     if (!me->rows || !me->nrows)
        return -1;              /* no row started! */
                                /* ##850_fail_if_fail?? */
+    if (me->rows[me->nrows - 1].ended)
+       Stbl_addRowToTable(me, alignment, lineno);
     Stbl_finishCellInTable(me, YES, lineno, pos);
     lastrow = me->rows + (me->nrows - 1);
 
@@ -1650,8 +1661,12 @@ PUBLIC int Stbl_finishCellInTable ARGS4(
     icell = lastrow->ncells - 1;
     if (icell < 0)
        return icell;
-    if (s->x_td == -1)
-       return end_td ? -1 : 0;
+    if (s->x_td == -1) {
+       if (end_td)
+           return -1;
+       lastrow->ended = ROW_ended_by_splitline;
+       return 0;
+    }
 
 #ifdef EXP_NESTED_TABLES
     /* This check for pos saves us from infinite recursion... */
@@ -1758,6 +1773,8 @@ PUBLIC int Stbl_finishCellInTable ARGS4(
     }
 #endif
 
+    if (!end_td)
+       lastrow->ended = ROW_ended_by_splitline;
 #ifndef EXP_NESTED_TABLES /* maxlen may already include contribution of a cell 
in this column */
     if (me->maxlen + (xlen - len) > MAX_STBL_POS)
        return -1;

; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]