version 1.16, 2009/11/18 17:02:17 |
version 1.17, 2009/12/03 22:50:10 |
|
|
{ |
{ |
u_int yy; |
u_int yy; |
|
|
GRID_DEBUG(gd, ""); |
GRID_DEBUG(gd, ""); |
|
|
if (gd->hsize < gd->hlimit) |
if (gd->hsize < gd->hlimit) |
return; |
return; |
|
|
gd->hsize -= yy; |
gd->hsize -= yy; |
} |
} |
|
|
/* |
/* |
* Scroll the entire visible screen, moving one line into the history. Just |
* Scroll the entire visible screen, moving one line into the history. Just |
* allocate a new line at the bottom and move the history size indicator. |
* allocate a new line at the bottom and move the history size indicator. |
*/ |
*/ |
|
|
{ |
{ |
u_int yy; |
u_int yy; |
|
|
GRID_DEBUG(gd, ""); |
GRID_DEBUG(gd, ""); |
|
|
yy = gd->hsize + gd->sy; |
yy = gd->hsize + gd->sy; |
gd->linedata = xrealloc(gd->linedata, yy + 1, sizeof *gd->linedata); |
gd->linedata = xrealloc(gd->linedata, yy + 1, sizeof *gd->linedata); |
memset(&gd->linedata[yy], 0, sizeof gd->linedata[yy]); |
memset(&gd->linedata[yy], 0, sizeof gd->linedata[yy]); |
|
|
gd->hsize++; |
gd->hsize++; |
} |
} |
|
|
|
|
struct grid_line *gl_history, *gl_upper, *gl_lower; |
struct grid_line *gl_history, *gl_upper, *gl_lower; |
u_int yy; |
u_int yy; |
|
|
GRID_DEBUG(gd, "upper=%u, lower=%u", upper, lower); |
GRID_DEBUG(gd, "upper=%u, lower=%u", upper, lower); |
|
|
/* Create a space for a new line. */ |
/* Create a space for a new line. */ |
yy = gd->hsize + gd->sy; |
yy = gd->hsize + gd->sy; |
|
|
{ |
{ |
u_int xx, yy; |
u_int xx, yy; |
|
|
GRID_DEBUG(gd, "px=%u, py=%u, nx=%u, ny=%u", px, py, nx, ny); |
GRID_DEBUG(gd, "px=%u, py=%u, nx=%u, ny=%u", px, py, nx, ny); |
|
|
if (nx == 0 || ny == 0) |
if (nx == 0 || ny == 0) |
return; |
return; |
|
|
struct grid_line *gl; |
struct grid_line *gl; |
u_int yy; |
u_int yy; |
|
|
GRID_DEBUG(gd, "py=%u, ny=%u", py, ny); |
GRID_DEBUG(gd, "py=%u, ny=%u", py, ny); |
|
|
if (ny == 0) |
if (ny == 0) |
return; |
return; |
|
|
{ |
{ |
u_int yy; |
u_int yy; |
|
|
GRID_DEBUG(gd, "dy=%u, py=%u, ny=%u", dy, py, ny); |
GRID_DEBUG(gd, "dy=%u, py=%u, ny=%u", dy, py, ny); |
|
|
if (ny == 0 || py == dy) |
if (ny == 0 || py == dy) |
return; |
return; |
|
|
struct grid_line *gl; |
struct grid_line *gl; |
u_int xx; |
u_int xx; |
|
|
GRID_DEBUG(gd, "dx=%u, px=%u, py=%u, nx=%u", dx, px, py, nx); |
GRID_DEBUG(gd, "dx=%u, px=%u, py=%u, nx=%u", dx, px, py, nx); |
|
|
if (nx == 0 || px == dx) |
if (nx == 0 || px == dx) |
return; |
return; |
|
|
char * |
char * |
grid_string_cells(struct grid *gd, u_int px, u_int py, u_int nx) |
grid_string_cells(struct grid *gd, u_int px, u_int py, u_int nx) |
{ |
{ |
const struct grid_cell *gc; |
const struct grid_cell *gc; |
const struct grid_utf8 *gu; |
const struct grid_utf8 *gu; |
char *buf; |
char *buf; |
size_t len, off, size; |
size_t len, off, size; |
u_int xx; |
u_int xx; |
|
|
buf[off++] = gc->data; |
buf[off++] = gc->data; |
} |
} |
} |
} |
|
|
while (off > 0 && buf[off - 1] == ' ') |
while (off > 0 && buf[off - 1] == ' ') |
off--; |
off--; |
buf[off] = '\0'; |
buf[off] = '\0'; |
return (buf); |
return (buf); |
} |
} |
|
|
/* |
/* |
* Duplicate a set of lines between two grids. If there aren't enough lines in |
* Duplicate a set of lines between two grids. If there aren't enough lines in |
* either source or destination, the number of lines is limited to the number |
* either source or destination, the number of lines is limited to the number |
* available. |
* available. |