=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/grid.c,v retrieving revision 1.15 retrieving revision 1.16 diff -c -r1.15 -r1.16 *** src/usr.bin/tmux/grid.c 2009/10/13 15:38:37 1.15 --- src/usr.bin/tmux/grid.c 2009/11/18 17:02:17 1.16 *************** *** 1,4 **** ! /* $OpenBSD: grid.c,v 1.15 2009/10/13 15:38:37 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: grid.c,v 1.16 2009/11/18 17:02:17 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott *************** *** 502,509 **** const struct grid_cell *gc; const struct grid_utf8 *gu; char *buf; ! size_t len, off; ! u_int xx, i; GRID_DEBUG(gd, "px=%u, py=%u, nx=%u", px, py, nx); --- 502,509 ---- const struct grid_cell *gc; const struct grid_utf8 *gu; char *buf; ! size_t len, off, size; ! u_int xx; GRID_DEBUG(gd, "px=%u, py=%u, nx=%u", px, py, nx); *************** *** 517,533 **** continue; if (gc->flags & GRID_FLAG_UTF8) { ! while (len < off + UTF8_SIZE + 1) { buf = xrealloc(buf, 2, len); len *= 2; } ! gu = grid_peek_utf8(gd, xx, py); ! for (i = 0; i < UTF8_SIZE; i++) { ! if (gu->data[i] == 0xff) ! break; ! buf[off++] = gu->data[i]; ! } } else { while (len < off + 2) { buf = xrealloc(buf, 2, len); --- 517,531 ---- continue; if (gc->flags & GRID_FLAG_UTF8) { ! gu = grid_peek_utf8(gd, xx, py); ! ! size = grid_utf8_size(gu); ! while (len < off + size + 1) { buf = xrealloc(buf, 2, len); len *= 2; } ! off += grid_utf8_copy(gu, buf + off, len - off); } else { while (len < off + 2) { buf = xrealloc(buf, 2, len);