8 -> UTF8_SIZE.

This commit is contained in:
Nicholas Marriott 2009-03-29 11:18:28 +00:00
parent 4cbf7d489e
commit 23fef99009
5 changed files with 14 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $Id: cmd-find-window.c,v 1.5 2009-03-28 20:17:29 nicm Exp $ */
/* $Id: cmd-find-window.c,v 1.6 2009-03-29 11:18:28 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -178,7 +178,7 @@ cmd_find_window_search(struct window_pane *wp, const char *searchstr)
if (gc->flags & GRID_FLAG_UTF8) {
gu = grid_view_peek_utf8(wp->base.grid, i, j);
buf = xrealloc(buf, 1, off + 8);
for (k = 0; k < 8; k++) {
for (k = 0; k < UTF8_SIZE; k++) {
if (gu->data[k] == 0xff)
break;
buf[off++] = gu->data[k];

View File

@ -1,4 +1,4 @@
/* $Id: screen-write.c,v 1.41 2009-03-29 11:06:22 nicm Exp $ */
/* $Id: screen-write.c,v 1.42 2009-03-29 11:18:28 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -561,14 +561,14 @@ screen_write_cell(
}
tmp_gu = grid_view_get_utf8(gd, s->cx - 1, s->cy);
for (i = 0; i < 8; i++) {
for (i = 0; i < UTF8_SIZE; i++) {
if (tmp_gu->data[i] == 0xff)
break;
}
memcpy(tmp_gu->data + i, udata, 8 - i);
memcpy(tmp_gu->data + i, udata, UTF8_SIZE - i);
/* Assume the previous character has just been input. */
for (size = 0; size < 8; size++) {
for (size = 0; size < UTF8_SIZE; size++) {
if (udata[size] == 0xff)
break;
}

5
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.291 2009-03-28 20:17:29 nicm Exp $ */
/* $Id: tmux.h,v 1.292 2009-03-29 11:18:28 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -493,9 +493,10 @@ struct grid_cell {
} __packed;
/* Grid cell UTF-8 data. Used instead of data in grid_cell for UTF-8 cells. */
#define UTF8_SIZE 8
struct grid_utf8 {
u_char width;
u_char data[8];
u_char data[UTF8_SIZE];
} __packed;
/* Entire grid of cells. */

6
tty.c
View File

@ -1,4 +1,4 @@
/* $Id: tty.c,v 1.85 2009-03-28 20:17:29 nicm Exp $ */
/* $Id: tty.c,v 1.86 2009-03-29 11:18:28 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -800,8 +800,8 @@ tty_cell(
return;
}
/* Otherwise, unpack UTF-8 and write it. */
for (i = 0; i < 8; i++) {
/* Otherwise, write UTF-8. */
for (i = 0; i < UTF8_SIZE; i++) {
if (gu->data[i] == 0xff)
break;
tty_putc(tty, gu->data[i]);

View File

@ -1,4 +1,4 @@
/* $Id: window-copy.c,v 1.52 2009-03-28 20:17:29 nicm Exp $ */
/* $Id: window-copy.c,v 1.53 2009-03-29 11:18:28 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -487,7 +487,7 @@ window_copy_copy_line(struct window_pane *wp,
} else {
gu = grid_peek_utf8(wp->base.grid, i, sy);
*buf = xrealloc(*buf, 1, (*off) + 8);
for (j = 0; j < 8; j++) {
for (j = 0; j < UTF8_SIZE; j++) {
if (gu->data[i] == 0xff)
break;
(*buf)[(*off)++] = gc->data;