diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-03-28 20:17:29 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-03-28 20:17:29 +0000 |
commit | cf7b384c43b4a2c5a1bde8b4f6bfeee20ecad027 (patch) | |
tree | f6fbcd72b5cfcd5b3579113c37cfd99efc5a0863 /grid-view.c | |
parent | 34dd72f0089537032429c88226ae66d4a5980575 (diff) | |
download | rtmux-cf7b384c43b4a2c5a1bde8b4f6bfeee20ecad027.tar.gz rtmux-cf7b384c43b4a2c5a1bde8b4f6bfeee20ecad027.tar.bz2 rtmux-cf7b384c43b4a2c5a1bde8b4f6bfeee20ecad027.zip |
Better UTF-8 support, including combined characters. Unicode data is now stored
as UTF-8 in a separate array, the code does a lookup into this every time it
gets to a UTF-8 cell. Zero width characters are just appended onto the UTF-8
data for the previous cell. This also means that almost no bytes extra are
wasted non-Unicode data (yay).
Still some oddities, such as copy mode skips over wide characters in a strange
way, and the code could do with some tidying.
Diffstat (limited to 'grid-view.c')
-rw-r--r-- | grid-view.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/grid-view.c b/grid-view.c index 407fdb9c..c6a56af8 100644 --- a/grid-view.c +++ b/grid-view.c @@ -1,4 +1,4 @@ -/* $Id: grid-view.c,v 1.10 2009-03-28 16:57:03 nicm Exp $ */ +/* $Id: grid-view.c,v 1.11 2009-03-28 20:17:29 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -37,13 +37,6 @@ grid_view_peek_cell(struct grid *gd, u_int px, u_int py) return (grid_peek_cell(gd, grid_view_x(gd, px), grid_view_y(gd, py))); } -/* Get cell text. */ -uint64_t -grid_view_peek_text(struct grid *gd, u_int px, u_int py) -{ - return (grid_peek_text(gd, grid_view_x(gd, px), grid_view_y(gd, py))); -} - /* Get cell for writing. */ struct grid_cell * grid_view_get_cell(struct grid *gd, u_int px, u_int py) @@ -59,11 +52,26 @@ grid_view_set_cell( grid_set_cell(gd, grid_view_x(gd, px), grid_view_y(gd, py), gc); } -/* Set text. */ +/* Get UTF-8 for reading. */ +const struct grid_utf8 * +grid_view_peek_utf8(struct grid *gd, u_int px, u_int py) +{ + return (grid_peek_utf8(gd, grid_view_x(gd, px), grid_view_y(gd, py))); +} + +/* Get UTF-8 for writing. */ +struct grid_utf8 * +grid_view_get_utf8(struct grid *gd, u_int px, u_int py) +{ + return (grid_get_utf8(gd, grid_view_x(gd, px), grid_view_y(gd, py))); +} + +/* Set UTF-8. */ void -grid_view_set_text(struct grid *gd, u_int px, u_int py, uint64_t text) +grid_view_set_utf8( + struct grid *gd, u_int px, u_int py, const struct grid_utf8 *gu) { - grid_set_text(gd, grid_view_x(gd, px), grid_view_y(gd, py), text); + grid_set_utf8(gd, grid_view_x(gd, px), grid_view_y(gd, py), gu); } /* Clear area. */ |