diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-03-28 16:30:05 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-03-28 16:30:05 +0000 |
commit | 6c0728fe0710c3a73ff0efbaf4e8e8281d99ecdf (patch) | |
tree | b918fc36a5daafdd3e5223aca3a4d5227d994d3e /tmux.h | |
parent | 5872633aeff2ae60735458e3904cfe00087dc30d (diff) | |
download | rtmux-6c0728fe0710c3a73ff0efbaf4e8e8281d99ecdf.tar.gz rtmux-6c0728fe0710c3a73ff0efbaf4e8e8281d99ecdf.tar.bz2 rtmux-6c0728fe0710c3a73ff0efbaf4e8e8281d99ecdf.zip |
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.
Diffstat (limited to 'tmux.h')
-rw-r--r-- | tmux.h | 29 |
1 files changed, 18 insertions, 11 deletions
@@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.287 2009-03-28 15:43:41 nicm Exp $ */ +/* $Id: tmux.h,v 1.288 2009-03-28 16:30:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -482,16 +482,15 @@ struct mode_key_data { #define GRID_FLAG_PADDING 0x4 #define GRID_FLAG_UTF8 0x8 -/* Grid cell. */ +/* Grid cell attributes. */ struct grid_cell { - u_short data; u_char attr; u_char flags; u_char fg; u_char bg; } __packed; -/* Grid data. */ +/* Entire grid of cells. */ struct grid { u_int sx; u_int sy; @@ -499,8 +498,10 @@ struct grid { u_int hsize; u_int hlimit; - u_int *size; + u_int *size; /* row size */ + struct grid_cell **data; + uint16_t **text; }; /* Option data structures. */ @@ -589,7 +590,8 @@ struct input_ctx { size_t len; size_t off; - struct grid_cell cell; /* current cell data */ + struct grid_cell cell; + uint64_t text; struct grid_cell saved_cell; u_int saved_cx; @@ -1054,7 +1056,7 @@ long long options_get_number(struct options *, const char *); void tty_reset(struct tty *); void tty_region(struct tty *, u_int, u_int, u_int); void tty_cursor(struct tty *, u_int, u_int, u_int); -void tty_cell(struct tty *, const struct grid_cell *); +void tty_cell(struct tty *, const struct grid_cell *, uint64_t); void tty_putcode(struct tty *, enum tty_code_code); void tty_putcode1(struct tty *, enum tty_code_code, int); void tty_putcode2(struct tty *, enum tty_code_code, int, int); @@ -1373,8 +1375,9 @@ void grid_expand_line(struct grid *, u_int, u_int); void grid_scroll_line(struct grid *); const struct grid_cell *grid_peek_cell(struct grid *, u_int, u_int); struct grid_cell *grid_get_cell(struct grid *, u_int, u_int); -void grid_set_cell( - struct grid *, u_int, u_int, const struct grid_cell *); +void grid_set_cell(struct grid *, u_int, u_int, const struct grid_cell *); +uint64_t grid_peek_text(struct grid *, u_int, u_int); +void grid_set_text(struct grid *, u_int, u_int, uint64_t); void grid_clear(struct grid *, u_int, u_int, u_int, u_int); void grid_fill(struct grid *, const struct grid_cell *, u_int, u_int, u_int, u_int); @@ -1387,9 +1390,12 @@ void grid_move_cells(struct grid *, u_int, u_int, u_int, u_int); /* grid-view.c */ const struct grid_cell *grid_view_peek_cell(struct grid *, u_int, u_int); +uint64_t grid_view_peek_text(struct grid *, u_int, u_int); struct grid_cell *grid_view_get_cell(struct grid *, u_int, u_int); void grid_view_set_cell( - struct grid *, u_int, u_int, const struct grid_cell *); + struct grid *, u_int, u_int, const struct grid_cell *); +uint64_t grid_view_peek_text(struct grid *, u_int, u_int); +void grid_view_set_text(struct grid *, u_int, u_int, uint64_t); void grid_view_clear(struct grid *, u_int, u_int, u_int, u_int); void grid_view_fill(struct grid *, const struct grid_cell *, u_int, u_int, u_int, u_int); @@ -1438,7 +1444,8 @@ void screen_write_kkeypadmode(struct screen_write_ctx *, int); void screen_write_clearendofscreen(struct screen_write_ctx *); void screen_write_clearstartofscreen(struct screen_write_ctx *); void screen_write_clearscreen(struct screen_write_ctx *); -void screen_write_cell(struct screen_write_ctx *, const struct grid_cell *); +void screen_write_cell( + struct screen_write_ctx *, const struct grid_cell *, uint64_t); /* screen-redraw.c */ void screen_redraw_screen(struct client *, struct screen *); |