[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lynx-dev Re: [PATCH 2.8.5-dev14] ladder in tables [Part II]
From: |
Ilya Zakharevich |
Subject: |
lynx-dev Re: [PATCH 2.8.5-dev14] ladder in tables [Part II] |
Date: |
Sat, 12 Apr 2003 23:04:21 -0700 |
User-agent: |
Mutt/1.4i |
On Sat, Apr 12, 2003 at 06:00:55PM -0700, Ilya Zakharevich wrote:
> This is the second part.
> Note also that suddently perl.com started to show formatted, though
> with not exactly correct ofset of the first line in the cell. Like this:
>
> [26]Safari Bookshelf
> O'Reilly Network
> Technologies [27].NET
> [28]Apache
> [29]BSD
> [30]ONJava.com
>
> Before this patch it would show completely flat.
It turned out that this behavior is a bug. This followup patch
provides a fix, and beefed up debugging output.
Enjoy,
Ilya
P.S. One test file is on ilyaz.org/software/tmp/table-test.html.
--- ./src/TRSTable.c-bad Sat Apr 12 19:06:16 2003
+++ ./src/TRSTable.c Sat Apr 12 21:42:56 2003
@@ -1459,6 +1459,7 @@ PRIVATE int Stbl_fakeFinishCellInTable A
for (n = me->allocated_rows - me->nrows - 1; n >= 0; --n)
lastrow[n + 1] = lastrow[n];
+ lastrow[1].content = 0;
/* Ignore cells, they belong to the next row now */
lastrow->allocated = 0;
lastrow->cells = 0;
@@ -1633,20 +1634,24 @@ PUBLIC BOOL Stbl_at_start_of_cell ARGS3(
int i;
CTRACE2(TRACE_TRST,
- (tfp, "TRST:Stbl_at_start_of_cell(lineno=%d, pos=%d)\n",
+ (tfp, "TRST:Stbl_at_start_of_cell(lineno=%d, pos=%d): ",
lineno, pos));
if (me->nrows == 0)
- return TRUE;
+ goto yes;
lastrow = me->rows + (me->nrows - 1);
if (lastrow->ended != ROW_not_ended)
- return FALSE; /* E.g., may be processing </tr> */
+ goto no; /* E.g., may be processing </tr> */
icell = lastrow->ncells - 1;
if (icell < 0)
- return TRUE;
+ goto yes;
if (lastrow->cells[icell].cLine != lineno
- || lastrow->cells[icell].pos != pos)
+ || lastrow->cells[icell].pos != pos) {
+ no:
+ CTRACE2(TRACE_TRST, (tfp, "no\n"));
return FALSE; /* XXXX What to do if cLine is -1? */
-
+ }
+ yes:
+ CTRACE2(TRACE_TRST, (tfp, "yes\n"));
return TRUE;
}
@@ -1676,8 +1681,7 @@ PUBLIC int Stbl_trimFakeRows ARGS3(
STable_rowinfo *prevrow, *lastrow;
int icell;
- CTRACE2(TRACE_TRST,
- (tfp, "TRST:Stbl_trimFakeRows()\n"));
+ CTRACE2(TRACE_TRST, (tfp, "TRST:Stbl_trimFakeRows()\n"));
/* XXXX The logic may be much better if we support removal of
RESERVED cells. Until this is done, bail out early: */
@@ -1693,11 +1697,14 @@ PUBLIC int Stbl_trimFakeRows ARGS3(
me->s.state = CS__0new; /* This is enough to revive things. */
me->s.x_td = lastrow->cells[lastrow->ncells - 1].pos;
me->s.lineno = lastrow->cells[lastrow->ncells - 1].cLine;
+ CTRACE2(TRACE_TRST, (tfp, " un-ended the last row.\n"));
return 1;
}
- if (me->nrows <= 1)
+ if (me->nrows <= 1 || !(lastrow->content & IS_CONTINUATION_OF_CELL))
return 0;
prevrow = me->rows + (me->nrows - 2);
+ if (prevrow->ncells != icell + 1) /* Empty cells were added after the
break */
+ return 0;
if ( prevrow->ended != ROW_ended_by_splitline) /* Lastrow non-fake */
return 0;
/* XXXX should remove duplicate RESERVED stuff too */
@@ -1705,12 +1712,14 @@ PUBLIC int Stbl_trimFakeRows ARGS3(
if (lastrow->cells && lastrow->allocated == 0) /* Moved to pool */
lastrow->cells = NULL;
lastrow->ncells = 0;
+ lastrow->content = 0;
prevrow->ended = ROW_not_ended; /* Give it new life */
/* We do not use state info for a lot of things any more, so do
not try to do anything special here */
me->s.state = CS__0new;
me->s.x_td = prevrow->cells[prevrow->ncells - 1].pos;
me->s.lineno = prevrow->cells[prevrow->ncells - 1].cLine;
+ CTRACE2(TRACE_TRST, (tfp, " Removed the last row.\n"));
return 1;
}
; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden