From da065599801b35070a83217ab79d7c22a2b5024b Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 25 Jan 2017 22:27:17 -0500 Subject: allow specifying whether or not emoji are wide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vim says yes, weechat says no ¯\_(ツ)_/¯ --- src/unicode-extra.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/unicode-extra.c') diff --git a/src/unicode-extra.c b/src/unicode-extra.c index 69e5c76..b661aef 100644 --- a/src/unicode-extra.c +++ b/src/unicode-extra.c @@ -66,15 +66,15 @@ static struct vt100_char_range vt100_wide_emoji[] = { }; static int vt100_is_zero_width(uint32_t codepoint); -static int vt100_is_wide_char(uint32_t codepoint); +static int vt100_is_wide_char(uint32_t codepoint, int wide_emoji); static int vt100_is_wide_emoji(uint32_t codepoint); -int vt100_char_width(uint32_t codepoint) +int vt100_char_width(uint32_t codepoint, int wide_emoji) { if (vt100_is_zero_width(codepoint)) { return 0; } - else if (vt100_is_wide_char(codepoint)) { + else if (vt100_is_wide_char(codepoint, wide_emoji)) { return 2; } else { @@ -89,9 +89,10 @@ static int vt100_is_zero_width(uint32_t codepoint) return g_unichar_iszerowidth(codepoint) || codepoint == 0xAD; } -static int vt100_is_wide_char(uint32_t codepoint) +static int vt100_is_wide_char(uint32_t codepoint, int wide_emoji) { - return g_unichar_iswide(codepoint) || vt100_is_wide_emoji(codepoint); + return g_unichar_iswide(codepoint) + || (wide_emoji && vt100_is_wide_emoji(codepoint)); } static int vt100_is_wide_emoji(uint32_t codepoint) -- cgit v1.2.3-54-g00ecf