From d533edf61eef15456efdf16bf45e68c824ee5870 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Wed, 21 Sep 2016 10:15:19 -0400 Subject: vim-patch:7.4.1604 Problem: Although emoji characters are ambiguous width, best is to treat them as full width. Solution: Update the Unicode character tables. Add the 'emoji' options. (Yasuhiro Matsumoto) https://github.com/vim/vim/commit/3848e00e0177abdb31bc600234967863ec487233 --- src/nvim/mbyte.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/nvim/mbyte.c') diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index f577fd847e..e05b3f3a37 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -949,6 +949,9 @@ int utf_char2cells(int c) if (intable(doublewidth, ARRAY_SIZE(doublewidth), c)) return 2; #endif + if (p_emoji && intable(emoji, ARRAY_SIZE(emoji), c)) { + return 2; + } } /* Characters below 0x100 are influenced by 'isprint' option */ else if (c >= 0x80 && !vim_isprintc(c)) -- cgit From 45598d2e5e2b56e24e4d5abe4f28f259e3def572 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 22 Sep 2016 00:40:45 -0400 Subject: vim-patch:7.4.1620 Problem: Emoji characters are not considered as a kind of word character. Solution: Give emoji characters a word class number. (Yashuhiro Matsumoto) https://github.com/vim/vim/commit/4077b33a8370afb3d5ae74e556a0119cf51fe294 --- src/nvim/mbyte.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/nvim/mbyte.c') diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index e05b3f3a37..e4ed46208b 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -949,7 +949,7 @@ int utf_char2cells(int c) if (intable(doublewidth, ARRAY_SIZE(doublewidth), c)) return 2; #endif - if (p_emoji && intable(emoji, ARRAY_SIZE(emoji), c)) { + if (p_emoji && intable(emoji_tab, ARRAY_SIZE(emoji_tab), c)) { return 2; } } @@ -1715,6 +1715,11 @@ int utf_class(int c) return (int)classes[mid].class; } + // emoji + if (intable(emoji_tab, ARRAY_SIZE(emoji_tab), c)) { + return 3; + } + /* most other characters are "word" characters */ return 2; } -- cgit From 1144cc6d9edd8d59b6f24e4d8f1df395342c2619 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 22 Sep 2016 00:43:19 -0400 Subject: vim-patch:7.4.1629 Problem: Handling emoji characters as full width has problems with backwards compatibility. Solution: Remove ambiguous and double width characters from the emoji table. Use a separate table for the character class. (partly by Yashuhiro Matsumoto) https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47 --- src/nvim/mbyte.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/mbyte.c') diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index e4ed46208b..2978171051 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -949,7 +949,7 @@ int utf_char2cells(int c) if (intable(doublewidth, ARRAY_SIZE(doublewidth), c)) return 2; #endif - if (p_emoji && intable(emoji_tab, ARRAY_SIZE(emoji_tab), c)) { + if (p_emoji && intable(emoji_width, ARRAY_SIZE(emoji_width), c)) { return 2; } } @@ -1716,7 +1716,7 @@ int utf_class(int c) } // emoji - if (intable(emoji_tab, ARRAY_SIZE(emoji_tab), c)) { + if (intable(emoji_all, ARRAY_SIZE(emoji_all), c)) { return 3; } -- cgit From 9e1c659666b5909b0ebb77406db42bc6892659d6 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 22 Sep 2016 00:58:46 -0400 Subject: vim-patch:7.4.1697 Problem: Display problems when the 'ambiwidth' and 'emoji' options are not set properly or the terminal doesn't behave as expected. Solution: After drawing an ambiguous width character always position the cursor. https://github.com/vim/vim/commit/cb0700844c1274fe8bc0ceaffaee0ad21c406f30 --- src/nvim/mbyte.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/nvim/mbyte.c') diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index 2978171051..c08b9e8fcf 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -1724,12 +1724,11 @@ int utf_class(int c) return 2; } -/* - * Code for Unicode case-dependent operations. Based on notes in - * http://www.unicode.org/Public/UNIDATA/CaseFolding.txt - * This code uses simple case folding, not full case folding. - * Last updated for Unicode 5.2. - */ +int utf_ambiguous_width(int c) +{ + return c >= 0x80 && (intable(ambiguous, ARRAY_SIZE(ambiguous), c) + || intable(emoji_all, ARRAY_SIZE(emoji_all), c)); +} /* * Generic conversion function for case operations. -- cgit