From 6c0728fe0710c3a73ff0efbaf4e8e8281d99ecdf Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 28 Mar 2009 16:30:05 +0000 Subject: Step 2 of the Grand Plan To Make UTF-8 Better. Split grid into two arrays, one containing grid attributes/flags/colours (keeps the name grid_cell for now) and a separate with the character data (called text). The text is stored as a u_short but is treated as a uint64_t elsewhere; eventually the grid will have two arrays. I'm not happy with the naming so that might change. Still need to decide where to go from here. I'm not sure whether to combine the peek/set functions together, and also whether to continue to treat the text as a uint64_t (and convert to/from Unicode) or make it a char array (of size one when UTF-8 disabled, eight when enabled) and keep everything as UTF-8. Also since UTF-8 will eventually become an attribute of the grid itself it might be nice to move all the padding crap into grid.c. --- grid-view.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'grid-view.c') diff --git a/grid-view.c b/grid-view.c index 443adbeb..c3801b5c 100644 --- a/grid-view.c +++ b/grid-view.c @@ -1,4 +1,4 @@ -/* $Id: grid-view.c,v 1.7 2009-03-28 15:43:41 nicm Exp $ */ +/* $Id: grid-view.c,v 1.8 2009-03-28 16:30:05 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -37,6 +37,13 @@ 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) @@ -52,6 +59,13 @@ grid_view_set_cell( grid_set_cell(gd, grid_view_x(gd, px), grid_view_y(gd, py), gc); } +/* Set text. */ +void +grid_view_set_text(struct grid *gd, u_int px, u_int py, uint64_t text) +{ + grid_set_text(gd, grid_view_x(gd, px), grid_view_y(gd, py), text); +} + /* Clear area. */ void grid_view_clear(struct grid *gd, u_int px, u_int py, u_int nx, u_int ny) -- cgit