# HG changeset patch # User Bram Moolenaar # Date 1659615329 -7200 # Node ID 5233acfa06f10e3eceb87a89d2ff86013cc96e2c # Parent 6eea3c60c85c958d01434259d69d0cbf7bf89114 patch 9.0.0138: not enough characters accepted for 'spellfile' Commit: https://github.com/vim/vim/commit/bc49c5f48f89c2d6f4d88ee77f44a11d68293be3 Author: Bram Moolenaar Date: Thu Aug 4 13:01:48 2022 +0100 patch 9.0.0138: not enough characters accepted for 'spellfile' Problem: Not enough characters accepted for 'spellfile'. Solution: Add vim_is_fname_char() and use it for 'spellfile'. diff --git a/src/charset.c b/src/charset.c --- a/src/charset.c +++ b/src/charset.c @@ -225,7 +225,8 @@ buf_init_chartab( } else { - g_chartab[c] = (g_chartab[c] & ~CT_CELL_MASK) + 1; + g_chartab[c] = (g_chartab[c] & ~CT_CELL_MASK) + + 1; g_chartab[c] |= CT_PRINT_CHAR; } } @@ -846,8 +847,10 @@ vim_iswordp_buf(char_u *p, buf_T *buf) } /* - * return TRUE if 'c' is a valid file-name character + * Return TRUE if 'c' is a valid file-name character as specified with the + * 'isfname' option. * Assume characters above 0x100 are valid (multi-byte). + * To be used for commands like "gf". */ int vim_isfilec(int c) @@ -856,6 +859,16 @@ vim_isfilec(int c) } /* + * Return TRUE if 'c' is a valid file-name character, including characters left + * out of 'isfname' to make "gf" work, such as comma, space, '@', etc. + */ + int +vim_is_fname_char(int c) +{ + return vim_isfilec(c) || c == ',' || c == ' ' || c == '@'; +} + +/* * return TRUE if 'c' is a valid file-name character or a wildcard character * Assume characters above 0x100 are valid (multi-byte). * Explicitly interpret ']' as a wildcard character as mch_has_wildcard("]") diff --git a/src/proto/charset.pro b/src/proto/charset.pro --- a/src/proto/charset.pro +++ b/src/proto/charset.pro @@ -25,6 +25,7 @@ int vim_iswordc_buf(int c, buf_T *buf); int vim_iswordp(char_u *p); int vim_iswordp_buf(char_u *p, buf_T *buf); int vim_isfilec(int c); +int vim_is_fname_char(int c); int vim_isfilec_or_wc(int c); int vim_isprintc(int c); int vim_isprintc_strict(int c); diff --git a/src/spell.c b/src/spell.c --- a/src/spell.c +++ b/src/spell.c @@ -4363,7 +4363,7 @@ valid_spellfile(char_u *val) char_u *s; for (s = val; *s != NUL; ++s) - if (!vim_isfilec(*s) && *s != ',' && *s != ' ') + if (!vim_is_fname_char(*s)) return FALSE; return TRUE; } diff --git a/src/testdir/test_spellfile.vim b/src/testdir/test_spellfile.vim --- a/src/testdir/test_spellfile.vim +++ b/src/testdir/test_spellfile.vim @@ -1160,4 +1160,12 @@ func Test_mkspellmem_opt() call assert_fails('set mkspellmem=1000,50,0', 'E474:') endfunc +" 'spellfile' accepts '@' on top of 'isfname'. +def Test_spellfile_allow_at_character() + mkdir('Xtest/the foo@bar,dir', 'p') + &spellfile = './Xtest/the foo@bar,dir/Xspellfile.add' + &spellfile = '' + delete('Xtest', 'rf') +enddef + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -736,6 +736,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 138, +/**/ 137, /**/ 136,