w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit 02cf3cd56cac150229d559742d32411504c88546
parent f6d5f2737247412c2597ee2fe1b4fac9b4f5acca
Author: ukai <ukai>
Date:   Fri, 25 Jan 2002 17:25:44 +0000

[w3m-dev 02913] wrong table width calculation
* table.c (set_table_matrix0): refine width calculation
From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>

Diffstat:
MChangeLog | 5+++++
Mtable.c | 34+++++++++++++++++++++++++++++-----
2 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,5 +1,10 @@ 2002-01-26 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> + * [w3m-dev 02913] wrong table width calculation + * table.c (set_table_matrix0): refine width calculation + +2002-01-26 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> + * [w3m-dev 02875] rendering a table with inconsistent colspan,rowspan * table.c (feed_table_tag): don't clear HTT_X|HTT_Y instead, if set these flags, break the loop diff --git a/table.c b/table.c @@ -3215,8 +3215,8 @@ set_table_matrix0(struct table *t, int maxwidth) { int size = t->maxcol + 1; int i, j, k, bcol, ecol; - int width, a; - double w0, w1, w, s, b; + int width; + double w0, w1, w, e, s, b; #ifdef __GNUC__ double we[size]; char expand[size]; @@ -3254,10 +3254,31 @@ set_table_matrix0(struct table *t, int maxwidth) } } + for (k = 0; k < cell->necell; k++) { + j = cell->eindex[k]; + bcol = cell->col[j]; + ecol = bcol + cell->colspan[j]; + width = cell->width[j] - (cell->colspan[j] - 1) * t->cellspacing; + e = 0.; + for (i = bcol; i < ecol; i++) { + e += expand[i]; + } + for (i = bcol; i < ecol; i++) { + w = weight(width * expand[i] / e); + if (w > we[i]) + we[i] = w; + } + } + + w0 = 0.; w1 = 0.; - for (i = 0; i < size; i++) + for (i = 0; i < size; i++) { + w0 += we[i]; if (expand[i] == 0) w1 += we[i]; + } + if (w0 <= 0.) + w0 = 1.; for (k = 0; k < cell->necell; k++) { j = cell->eindex[k]; @@ -3265,8 +3286,11 @@ set_table_matrix0(struct table *t, int maxwidth) width = cell->width[j] - (cell->colspan[j] - 1) * t->cellspacing; w = weight(width); s = w / (w1 + w); - a = (int)(s * maxwidth); - b = sigma_td_nw(a); +#if 0 + b = sigma_td_nw((int)(s * maxwidth * cell->colspan[j])); +#else + b = sigma_td_nw((int)(s * maxwidth)); +#endif correct_table_matrix4(t, bcol, cell->colspan[j], expand, s, b); }