summaryrefslogtreecommitdiffstats
path: root/screen.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-08-08 13:29:27 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-08-08 13:29:27 +0000
commit5e01b6d663abc086847c9bec145edeb9cd91530a (patch)
treea8708ca5f4a199352452945133a6fc11af807e08 /screen.c
parente89e70e71575417195285a3ea55c430654f9fc21 (diff)
Change the way the grid is stored, previously it was:
- a two-dimensional array of cells; - a two-dimensional array of utf8 data; - an array of line lengths. Now it is a single array of a new struct grid_line each of which represents a line and containts the length and an array of cells and an array of utf8 data. This will make it easier to add additional per-line members, such as flags.
Diffstat (limited to 'screen.c')
-rw-r--r--screen.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/screen.c b/screen.c
index b2bcffa3..bcf52099 100644
--- a/screen.c
+++ b/screen.c
@@ -194,10 +194,8 @@ screen_resize_y(struct screen *s, u_int sy)
}
/* Resize line arrays. */
- gd->size = xrealloc(gd->size, gd->hsize + sy, sizeof *gd->size);
- gd->data = xrealloc(gd->data, gd->hsize + sy, sizeof *gd->data);
- gd->usize = xrealloc(gd->usize, gd->hsize + sy, sizeof *gd->usize);
- gd->udata = xrealloc(gd->udata, gd->hsize + sy, sizeof *gd->udata);
+ gd->linedata = xrealloc(
+ gd->linedata, gd->hsize + sy, sizeof *gd->linedata);
/* Size increasing. */
if (sy > oldy) {
@@ -218,12 +216,8 @@ screen_resize_y(struct screen *s, u_int sy)
needed -= available;
/* Then fill the rest in with blanks. */
- for (i = gd->hsize + sy - needed; i < gd->hsize + sy; i++) {
- gd->size[i] = 0;
- gd->data[i] = NULL;
- gd->usize[i] = 0;
- gd->udata[i] = NULL;
- }
+ for (i = gd->hsize + sy - needed; i < gd->hsize + sy; i++)
+ memset(&gd->linedata[i], 0, sizeof gd->linedata[i]);
}
/* Set the new size, and reset the scroll region. */