aboutsummaryrefslogtreecommitdiff
path: root/grid.c
diff options
context:
space:
mode:
authorThomas <thomas@xteddy.org>2013-10-11 14:33:29 +0100
committerThomas <thomas@xteddy.org>2013-10-11 14:33:29 +0100
commit7f479ffdce8f49f6c57d575b708c4cbe8cbe18df (patch)
treec0b1ddfb340c9bd59bbc02e83f30bf34aeb29a88 /grid.c
parentc190c73240576aa2a8274a305844f1fa7fcb0e71 (diff)
parent4901d9ddc8d8c33ecdca363dcb67e66482745fa5 (diff)
downloadrtmux-7f479ffdce8f49f6c57d575b708c4cbe8cbe18df.tar.gz
rtmux-7f479ffdce8f49f6c57d575b708c4cbe8cbe18df.tar.bz2
rtmux-7f479ffdce8f49f6c57d575b708c4cbe8cbe18df.zip
Merge branch 'obsd-master' into mtemp
Diffstat (limited to 'grid.c')
-rw-r--r--grid.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/grid.c b/grid.c
index 2955e8ba..9e800243 100644
--- a/grid.c
+++ b/grid.c
@@ -268,8 +268,7 @@ grid_get_cell(struct grid *gd, u_int px, u_int py)
/* Set cell at relative position. */
void
-grid_set_cell(
- struct grid *gd, u_int px, u_int py, const struct grid_cell *gc)
+grid_set_cell(struct grid *gd, u_int px, u_int py, const struct grid_cell *gc)
{
if (grid_check_y(gd, py) != 0)
return;
@@ -592,6 +591,7 @@ grid_string_cells(struct grid *gd, u_int px, u_int py, u_int nx,
char *buf, code[128];
size_t len, off, size, codelen;
u_int xx;
+ const struct grid_line *gl;
GRID_DEBUG(gd, "px=%u, py=%u, nx=%u", px, py, nx);
@@ -604,8 +604,11 @@ grid_string_cells(struct grid *gd, u_int px, u_int py, u_int nx,
buf = xmalloc(len);
off = 0;
+ gl = grid_peek_line(gd, py);
for (xx = px; xx < px + nx; xx++) {
- gc = grid_peek_cell(gd, xx, py);
+ if (gl == NULL || xx >= gl->cellsize)
+ break;
+ gc = &gl->celldata[xx];
if (gc->flags & GRID_FLAG_PADDING)
continue;
grid_cell_get(gc, &ud);
@@ -653,8 +656,8 @@ grid_string_cells(struct grid *gd, u_int px, u_int py, u_int nx,
* available.
*/
void
-grid_duplicate_lines(
- struct grid *dst, u_int dy, struct grid *src, u_int sy, u_int ny)
+grid_duplicate_lines(struct grid *dst, u_int dy, struct grid *src, u_int sy,
+ u_int ny)
{
struct grid_line *dstl, *srcl;
u_int yy;