=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/grid.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- src/usr.bin/tmux/grid.c 2013/03/25 10:07:40 1.29 +++ src/usr.bin/tmux/grid.c 2013/10/10 11:49:29 1.30 @@ -1,4 +1,4 @@ -/* $OpenBSD: grid.c,v 1.29 2013/03/25 10:07:40 nicm Exp $ */ +/* $OpenBSD: grid.c,v 1.30 2013/10/10 11:49:29 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -592,6 +592,7 @@ 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 +605,11 @@ 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);