w3m

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

commit b92dec1ab3540f99aa39a8634efacb9ae1d1f678
parent 4518ce9f1da742002d556e7cabf6a2d8977b3239
Author: ukai <ukai>
Date:   Fri, 25 Jan 2002 15:10:14 +0000

[w3m-dev 02909] wrong table width calculation (sf.net Bug#506949)
* table.c (correct_table_matrix4): added
* table.c (set_table_matrix0): use correct_table_matrix4()
From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>

Diffstat:
MChangeLog | 6++++++
Mtable.c | 52++++++++++++++++++++++++++++++++++++++++------------
2 files changed, 46 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,9 @@ +2002-01-26 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> + + * [w3m-dev 02909] wrong table width calculation (sf.net Bug#506949) + * table.c (correct_table_matrix4): added + * table.c (set_table_matrix0): use correct_table_matrix4() + 2002-01-25 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> * [w3m-dev 02908] document code of frame diff --git a/table.c b/table.c @@ -3180,11 +3180,38 @@ correct_table_matrix3(struct table *t, int col, char *flags, double s, } static void +correct_table_matrix4(struct table *t, int col, int cspan, char *flags, + double s, double b) +{ + int i, j; + double ss; + int ecol = col + cspan; + int size = t->maxcol + 1; + double w = 1. / (b * b); + + for (i = 0; i < size; i++) { + if (flags[i] && !(i >= col && i < ecol)) + continue; + for (j = i; j < size; j++) { + if (flags[j] && !(j >= col && j < ecol)) + continue; + if (i >= col && i < ecol && j >= col && j < ecol) + ss = (1. - s) * (1. - s); + else if ((i >= col && i < ecol) || (j >= col && j < ecol)) + ss = -(1. - s) * s; + else + ss = s * s; + m_add_val(t->matrix, i, j, w * ss); + } + } +} + +static void set_table_matrix0(struct table *t, int maxwidth) { int size = t->maxcol + 1; int i, j, k, bcol, ecol; - int swidth, width, a; + int width, a; double w0, w1, w, s, b; #ifdef __GNUC__ double we[size]; @@ -3218,26 +3245,27 @@ set_table_matrix0(struct table *t, int maxwidth) j = cell->eindex[k]; bcol = cell->col[j]; ecol = bcol + cell->colspan[j]; - swidth = 0; for (i = bcol; i < ecol; i++) { - swidth += t->tabwidth[i]; expand[i]++; } - width = cell->width[j] - (cell->colspan[j] - 1) * t->cellspacing; - w = weight(width); - w1 = 0.; - for (i = bcol; i < ecol; i++) - w1 += we[i]; - s = w / (w0 + w - w1); - a = (int)(s * maxwidth); - b = sigma_td_nw(a); - correct_table_matrix2(t, bcol, cell->colspan[j], s, b); } w1 = 0.; for (i = 0; i < size; i++) if (expand[i] == 0) w1 += we[i]; + + for (k = 0; k < cell->necell; k++) { + j = cell->eindex[k]; + bcol = cell->col[j]; + 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); + correct_table_matrix4(t, bcol, cell->colspan[j], expand, s, b); + } + for (i = 0; i < size; i++) { if (expand[i] == 0) { s = we[i] / max(w1, 1.);