diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-11-18 17:02:17 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-11-18 17:02:17 +0000 |
commit | a78cc98c8bd79cecbb8574a9dff4c9867a8308d9 (patch) | |
tree | 479fa44868219f4e3c39720a6c0068f947ac36d5 /tmux.h | |
parent | 8db145da1ed40d471e9ecff0e788ced26a43fc92 (diff) | |
download | rtmux-a78cc98c8bd79cecbb8574a9dff4c9867a8308d9.tar.gz rtmux-a78cc98c8bd79cecbb8574a9dff4c9867a8308d9.tar.bz2 rtmux-a78cc98c8bd79cecbb8574a9dff4c9867a8308d9.zip |
Cleanup by moving various (mostly horrible) little bits handling UTF-8 grid
data into functions in a new file, grid-utf8.c, and use sizeof intead of
UTF8_DATA.
Also nuke trailing whitespace from tmux.1, reminded by jmc.
Diffstat (limited to 'tmux.h')
-rw-r--r-- | tmux.h | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -74,6 +74,12 @@ extern char **environ; #define PRINT_LENGTH 512 /* printed error/message size */ #define ENVIRON_LENGTH 1024 /* environment variable length */ +/* + * UTF-8 data size. This must be big enough to hold combined characters as well + * as single. + */ +#define UTF8_SIZE 9 + /* Fatal errors. */ #define fatal(msg) log_fatal("%s: %s", __func__, msg); #define fatalx(msg) log_fatalx("%s: %s", __func__, msg); @@ -525,13 +531,12 @@ struct mode_key_table { #define MODE_MOUSE 0x10 /* - * A single UTF-8 character. + * A single UTF-8 character. * * The data member in this must be UTF8_SIZE to allow screen_write_copy to * reinject stored UTF-8 data back into screen_write_cell after combining (ugh * XXX XXX). */ -#define UTF8_SIZE 9 struct utf8_data { u_char data[UTF8_SIZE]; @@ -1675,6 +1680,13 @@ char *grid_string_cells(struct grid *, u_int, u_int, u_int); void grid_duplicate_lines( struct grid *, u_int, struct grid *, u_int, u_int); +/* grid-utf8.c */ +size_t grid_utf8_size(const struct grid_utf8 *); +size_t grid_utf8_copy(const struct grid_utf8 *, char *, size_t); +void grid_utf8_set(struct grid_utf8 *, const struct utf8_data *); +int grid_utf8_append(struct grid_utf8 *, const struct utf8_data *); +int grid_utf8_compare(const struct grid_utf8 *, const struct grid_utf8 *); + /* grid-view.c */ const struct grid_cell *grid_view_peek_cell(struct grid *, u_int, u_int); struct grid_cell *grid_view_get_cell(struct grid *, u_int, u_int); |