diff options
author | James McCoy <jamessan@jamessan.com> | 2016-09-26 22:16:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-26 22:16:17 -0400 |
commit | f610b807b48dbaf96fe05459927a8c926b67f8bb (patch) | |
tree | 71429c5408ff4e26af9c66adf8cf8956622373cf /src/nvim/mbyte.c | |
parent | 68bcb32ec43e2fab30dc05439fc77cf28793922c (diff) | |
parent | 4ce24ff9da0f6551eeca2011dc9d05194bf02e12 (diff) | |
download | rneovim-f610b807b48dbaf96fe05459927a8c926b67f8bb.tar.gz rneovim-f610b807b48dbaf96fe05459927a8c926b67f8bb.tar.bz2 rneovim-f610b807b48dbaf96fe05459927a8c926b67f8bb.zip |
Merge pull request #5372 from jamessan/vim-7.4.1604
vim-patch:7.4.1604,7.4.1620,7.4.1629,7.4.1630,7.4.1642,7.4.1697
Closes #5149
Diffstat (limited to 'src/nvim/mbyte.c')
-rw-r--r-- | src/nvim/mbyte.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index f577fd847e..c08b9e8fcf 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_width, ARRAY_SIZE(emoji_width), c)) { + return 2; + } } /* Characters below 0x100 are influenced by 'isprint' option */ else if (c >= 0x80 && !vim_isprintc(c)) @@ -1712,16 +1715,20 @@ int utf_class(int c) return (int)classes[mid].class; } + // emoji + if (intable(emoji_all, ARRAY_SIZE(emoji_all), c)) { + return 3; + } + /* most other characters are "word" characters */ 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. |