diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-03-19 18:42:29 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-03-19 18:42:29 +0100 |
commit | 3848e00e0177abdb31bc600234967863ec487233 (patch) | |
tree | 24e98aae0cf331b430e63f4dfb712dc161d2190d /runtime/tools | |
parent | bfb96c047b79b2aab5fd57a2472871508819f3ef (diff) | |
download | vim-git-3848e00e0177abdb31bc600234967863ec487233.tar.gz |
patch 7.4.1604v7.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)
Diffstat (limited to 'runtime/tools')
-rw-r--r-- | runtime/tools/unicode.vim | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/runtime/tools/unicode.vim b/runtime/tools/unicode.vim index d733fe867..dfe9cef41 100644 --- a/runtime/tools/unicode.vim +++ b/runtime/tools/unicode.vim @@ -251,6 +251,27 @@ func! BuildWidthTable(pattern, tableName) wincmd p endfunc +" Build the amoji width table in a new buffer. +func! BuildEmojiTable(pattern, tableName) + let ranges = [] + for line in map(filter(filter(getline(1, '$'), 'v:val=~"^[1-9]"'), 'v:val=~a:pattern'), 'matchstr(v:val,"^\\S\\+")') + let token = split(line, '\.\.') + if len(token) == 1 + call add(token, token[0]) + endif + call add(ranges, printf("\t{0x%04x, 0x%04x},", "0x".token[0], "0x".token[1])) + endfor + + " New buffer to put the result in. + new + exe "file " . a:tableName + call setline(1, " static struct interval " . a:tableName . "[] =") + call setline(2, " {") + call append('$', ranges) + call setline('$', getline('$')[:-2]) " remove last comma + call setline(line('$') + 1, " };") + wincmd p +endfunc " Try to avoid hitting E36 set equalalways @@ -290,3 +311,9 @@ call BuildWidthTable('[WF]', 'doublewidth') " Build the ambiguous width table. call BuildWidthTable('A', 'ambiguous') + +" Edit the emoji text file. Requires the netrw plugin. +edit http://www.unicode.org/Public/emoji/3.0/emoji-data.txt + +" Build the emoji table. Ver. 1.0 - 6.0 +call BuildEmojiTable('; Emoji\s\+# [1-6]\.[0-9]', 'emoji') |