diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-01-18 21:46:30 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-01-18 21:46:30 +0000 |
commit | 4cdc228353246ef8e05f89e44e5e7968807ff19d (patch) | |
tree | 84db6663ac120b9d4a48af7914d88f59da382e52 /screen-write.c | |
parent | 7bc8be006eb45af0f5fc1fa6dc79b638d2d1b66f (diff) | |
download | rtmux-4cdc228353246ef8e05f89e44e5e7968807ff19d.tar.gz rtmux-4cdc228353246ef8e05f89e44e5e7968807ff19d.tar.bz2 rtmux-4cdc228353246ef8e05f89e44e5e7968807ff19d.zip |
Unbreak UTF-8.
Diffstat (limited to 'screen-write.c')
-rw-r--r-- | screen-write.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/screen-write.c b/screen-write.c index 07f348ba..c1514238 100644 --- a/screen-write.c +++ b/screen-write.c @@ -1,4 +1,4 @@ -/* $Id: screen-write.c,v 1.26 2009-01-18 21:21:53 nicm Exp $ */ +/* $Id: screen-write.c,v 1.27 2009-01-18 21:46:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -514,7 +514,11 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc) const struct grid_cell *hc; struct grid_cell *ic, tc; - width = utf8_width(gc->data); + /* Find character width. */ + if (gc->flags & GRID_FLAG_UTF8) + width = utf8_width(gc->data); + else + width = 1; /* If the character is wider than the screen, don't print it. */ if (width > screen_size_x(s)) { @@ -570,7 +574,7 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc) break; grid_view_set_cell(gd, xx, s->cy, &grid_default_cell); } - } else if (utf8_width(hc->data) > 1) { + } else if (hc->flags & GRID_FLAG_UTF8 && utf8_width(hc->data) > 1) { /* * An UTF-8 wide cell; overwrite following padding cells only. */ @@ -593,6 +597,7 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc) ic->flags |= GRID_FLAG_PADDING; } +not_utf8: /* Write the actual cell. */ grid_view_set_cell(gd, s->cx, s->cy, gc); |