diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-01-03 23:35:23 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-01-03 23:35:23 +0000 |
commit | 60a5e3c43953dd77bf29755321b3d66b06f98807 (patch) | |
tree | 91217062f2651726a0c23d83127428f95860d928 /usr.bin/tmux/utf8.c | |
parent | 6ddc11e3560b59e0be8c0f3faf575383ef0c85f6 (diff) |
Support for UTF-8 mouse input (\033[1005h). This was added in xterm 262
and supports larger terminals than the older way.
If the new mouse-utf8 option is on, UTF-8 mouse input is enabled for all
UTF-8 terminals. The option defaults to on if LANG etc are set in the
same manner as the utf8 option.
With help and based on code from hsim at gmx.li.
Diffstat (limited to 'usr.bin/tmux/utf8.c')
-rw-r--r-- | usr.bin/tmux/utf8.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.bin/tmux/utf8.c b/usr.bin/tmux/utf8.c index c4af1c36bc2..53c2d1c6782 100644 --- a/usr.bin/tmux/utf8.c +++ b/usr.bin/tmux/utf8.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utf8.c,v 1.5 2009/10/20 22:17:33 nicm Exp $ */ +/* $OpenBSD: utf8.c,v 1.6 2011/01/03 23:35:22 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -318,6 +318,19 @@ utf8_combine(const struct utf8_data *utf8data) return (value); } +/* Split a two-byte UTF-8 character. */ +u_int +utf8_split2(u_int uc, u_char *ptr) +{ + if (uc > 0x7f) { + ptr[0] = (uc >> 6) | 0xc0; + ptr[1] = (uc & 0x3f) | 0x80; + return (2); + } + ptr[0] = uc; + return (1); +} + /* Lookup width of UTF-8 data in tree. */ u_int utf8_width(const struct utf8_data *utf8data) |