[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, 10 May 2003 00:00:17 -0700 |
User-agent: |
Mutt/1.4i |
On Sun, Apr 27, 2003 at 12:57:30PM -0700, Ilya Zakharevich wrote:
> On Sat, Apr 12, 2003 at 11:04:21PM -0700, Ilya Zakharevich wrote:
> > On Sat, Apr 12, 2003 at 06:00:55PM -0700, Ilya Zakharevich wrote:
> > > This is the second part.
> I retested with fresh 2.8.5-dev14, and found no conflict of patches.
The attached patch makes a minor memory saving (circa 15%) for table
processing, improves yet another case of "ladder" (as in the top of
google results), and fixes one case of "wrong indentation" (elements
of a table which contained <center> were made too wide).
In my testing it is not worse now than the old version even in the
cases designed to break the new algorithm (they break the old as well ;-).
Enjoy,
Ilya
--- ./src/TRSTable.c-pre Mon May 5 13:48:46 2003
+++ ./src/TRSTable.c Fri May 9 23:49:10 2003
@@ -79,10 +79,10 @@ typedef struct _STable_cellinfo {
contentless cells (and cells we do
not want to measure and count?),
line-of-the-start otherwise. */
- int pos; /* column where cell starts */
- int len; /* number of character positions */
- int colspan; /* number of columns to span */
- int alignment; /* one of HT_LEFT, HT_CENTER, HT_RIGHT,
+ short pos; /* column where cell starts */
+ short len; /* number of character positions */
+ short colspan; /* number of columns to span */
+ short alignment; /* one of HT_LEFT, HT_CENTER, HT_RIGHT,
or RESERVEDCELL */
} STable_cellinfo;
@@ -98,12 +98,13 @@ enum ended_state {
#define OFFSET_IS_VALID 8
#define OFFSET_IS_VALID_LAST_CELL 0x10
#define BELIEVE_OFFSET 0x20
+#define IS_CONTINUATION_OF_MULTICELL 0x40
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: */
int Line; /* lineno in doc (zero-based) */
- int ncells; /* number of table cells */
+ short ncells; /* number of table cells */
/* What is the meaning of this?! It is set if:
[search for def of fixed_line below]
@@ -127,14 +128,14 @@ typedef struct _STable_rowinfo {
REMARK: If this variable is not set, but icell_core is, Line is
reset to the line of icell_core.
*/
- BOOL fixed_line; /* if we have a 'core' line of cells */
+ short fixed_line; /* if we have a 'core' line of cells */
enum ended_state ended; /* if we saw </tr> etc */
- int content; /* Whether contains end-of-cell etc */
- int offset; /* >=0 after line break in a multiline cell */
- int allocated; /* number of table cells allocated or 0
+ short content; /* Whether contains end-of-cell etc */
+ short offset; /* >=0 after line break in a multiline cell */
+ short allocated; /* number of table cells allocated or 0
if the .cells should not be free()ed */
+ short alignment; /* global align attribute for this row */
STable_cellinfo * cells;
- int alignment; /* global align attribute for this row */
} STable_rowinfo;
struct _STable_chunk;
@@ -1365,11 +1366,17 @@ PRIVATE int Stbl_fakeFinishCellInTable A
int prev_reserved_last = -1;
STable_rowinfo *prev_row;
int prev_row_n2 = lastrow - me->rows;
+ int is_multicell = 0;
CTRACE2(TRACE_TRST,
(tfp, "TRST:Stbl_fakeFinishCellInTable(lineno=%d, finishing=%d)
START FAKING\n",
lineno, finishing));
+ if ( lastrow->ncells > 1
+ && (lastrow->cells[lastrow->ncells - 2].pos
+ != lastrow->cells[lastrow->ncells - 1].pos))
+ is_multicell = 1;
+
/* Although here we use pos=0, this may commit the previous
cell which had <BR> as a last element. This may overflow
the screen width, so the additional checks performed in
@@ -1391,6 +1398,10 @@ PRIVATE int Stbl_fakeFinishCellInTable A
}
lastrow = me->rows + (me->nrows - 1);
lastrow->content = IS_CONTINUATION_OF_CELL;
+ if (is_multicell)
+ lastrow->content = IS_CONTINUATION_OF_MULTICELL;
+ else
+ lastrow->content = IS_CONTINUATION_OF_CELL;
for (i = 0; i < lastrow->allocated; i++) {
if (lastrow->cells[i].alignment == RESERVEDCELL) {
need_reserved = 1;
--- ./src/GridText.c-pre Fri May 9 23:40:18 2003
+++ ./src/GridText.c Fri May 9 23:33:56 2003
@@ -3368,6 +3368,8 @@ PRIVATE void blank_lines ARGS2(
newlines--; /* Don't bother: already blank */
line = line->prev;
}
+ } else if (AT_START_OF_CELL(text)) {
+ newlines = 1; /* New line to get a correct offset */
} else {
newlines++; /* Need also to finish this line */
}
; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- lynx-dev Re: [PATCH 2.8.5-dev14] ladder in tables [Part II],
Ilya Zakharevich <=