version 1.118, 2020/06/05 09:35:41 |
version 1.119, 2020/08/07 07:02:57 |
|
|
sx = gd->sx / 4; |
sx = gd->sx / 4; |
else if (sx < gd->sx / 2) |
else if (sx < gd->sx / 2) |
sx = gd->sx / 2; |
sx = gd->sx / 2; |
else |
else if (gd->sx > sx) |
sx = gd->sx; |
sx = gd->sx; |
|
|
gl->celldata = xreallocarray(gl->celldata, sx, sizeof *gl->celldata); |
gl->celldata = xreallocarray(gl->celldata, sx, sizeof *gl->celldata); |
|
|
struct grid *target; |
struct grid *target; |
struct grid_line *gl; |
struct grid_line *gl; |
struct grid_cell gc; |
struct grid_cell gc; |
u_int yy, width, i, at, first; |
u_int yy, width, i, at; |
|
|
/* |
/* |
* Create a destination grid. This is just used as a container for the |
* Create a destination grid. This is just used as a container for the |
|
|
continue; |
continue; |
|
|
/* |
/* |
* Work out the width of this line. first is the width of the |
* Work out the width of this line. at is the point at which |
* first character, at is the point at which the available |
* the available width is hit, and width is the full line |
* width is hit, and width is the full line width. |
* width. |
*/ |
*/ |
first = at = width = 0; |
at = width = 0; |
if (~gl->flags & GRID_LINE_EXTENDED) { |
if (~gl->flags & GRID_LINE_EXTENDED) { |
first = 1; |
|
width = gl->cellused; |
width = gl->cellused; |
if (width > sx) |
if (width > sx) |
at = sx; |
at = sx; |
|
|
} else { |
} else { |
for (i = 0; i < gl->cellused; i++) { |
for (i = 0; i < gl->cellused; i++) { |
grid_get_cell1(gl, i, &gc); |
grid_get_cell1(gl, i, &gc); |
if (i == 0) |
|
first = gc.data.width; |
|
if (at == 0 && width + gc.data.width > sx) |
if (at == 0 && width + gc.data.width > sx) |
at = i; |
at = i; |
width += gc.data.width; |
width += gc.data.width; |
|
|
} |
} |
|
|
/* |
/* |
* If the line is exactly right or the first character is wider |
* If the line is exactly right, just move it across |
* than the target width, just move it across unchanged. |
* unchanged. |
*/ |
*/ |
if (width == sx || first > sx) { |
if (width == sx) { |
grid_reflow_move(target, gl); |
grid_reflow_move(target, gl); |
continue; |
continue; |
} |
} |