From 219442cff707a1febb6a75ba2cfe48b02ae0a22e Mon Sep 17 00:00:00 2001 From: Tiago Cunha Date: Fri, 7 Jan 2011 14:34:45 +0000 Subject: Sync OpenBSD patchset 828: 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. --- utf8.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'utf8.c') diff --git a/utf8.c b/utf8.c index 182cd101..0244a065 100644 --- a/utf8.c +++ b/utf8.c @@ -1,4 +1,4 @@ -/* $Id: utf8.c,v 1.11 2009-10-23 17:21:34 tcunha Exp $ */ +/* $Id: utf8.c,v 1.12 2011-01-07 14:34:45 tcunha Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -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) -- cgit