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)

3848e00e01
This commit is contained in:
James McCoy
2016-09-21 10:15:19 -04:00
parent 68bcb32ec4
commit d533edf61e
10 changed files with 80 additions and 15 deletions

View File

@@ -39,6 +39,7 @@ set(UNICODE_DIR ${PROJECT_SOURCE_DIR}/unicode)
set(UNICODEDATA_FILE ${UNICODE_DIR}/UnicodeData.txt)
set(CASEFOLDING_FILE ${UNICODE_DIR}/CaseFolding.txt)
set(EASTASIANWIDTH_FILE ${UNICODE_DIR}/EastAsianWidth.txt)
set(EMOJI_FILE ${UNICODE_DIR}/emoji-data.txt)
set(GENERATED_UNICODE_TABLES ${GENERATED_DIR}/unicode_tables.generated.h)
include_directories(${GENERATED_DIR})
@@ -195,12 +196,14 @@ add_custom_command(OUTPUT ${GENERATED_UNICODE_TABLES}
${UNICODEDATA_FILE}
${CASEFOLDING_FILE}
${EASTASIANWIDTH_FILE}
${EMOJI_FILE}
${GENERATED_UNICODE_TABLES}
DEPENDS
${UNICODE_TABLES_GENERATOR}
${UNICODEDATA_FILE}
${CASEFOLDING_FILE}
${EASTASIANWIDTH_FILE}
${EMOJI_FILE}
)
add_custom_command(OUTPUT ${GENERATED_API_DISPATCH} ${API_METADATA}

View File

@@ -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))

View File

@@ -2520,7 +2520,7 @@ did_set_string_option (
errmsg = e_invarg;
}
/* 'ambiwidth' */
else if (varp == &p_ambw) {
else if (varp == &p_ambw || (bool *)varp == &p_emoji) {
if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK)
errmsg = e_invarg;
else if (set_chars_option(&p_lcs) != NULL)

View File

@@ -402,6 +402,7 @@ static char *(p_dy_values[]) = {"lastline", "uhex", NULL};
#define DY_LASTLINE 0x001
#define DY_UHEX 0x002
EXTERN int p_ed; /* 'edcompatible' */
EXTERN bool p_emoji; // 'emoji'
EXTERN char_u *p_ead; /* 'eadirection' */
EXTERN bool p_ea; /* 'equalalways' */
EXTERN char_u *p_ep; /* 'equalprg' */

View File

@@ -643,6 +643,14 @@ return {
varname='p_force_off',
defaults={if_true={vi=false}}
},
{
full_name='emoji', abbreviation='emo',
type='bool', scope={'global'},
vi_def=true,
redraw={'everything'},
varname='p_emoji',
defaults={if_true={vi=true}}
},
{
full_name='encoding', abbreviation='enc',
type='string', scope={'global'},

View File

@@ -839,7 +839,7 @@ static int included_patches[] = {
// 1607,
// 1606,
// 1605,
// 1604,
1604,
1603,
// 1602 NA
// 1601 NA