Patch 9.0.0138

2 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 4, 2022, 8:02:19 AM8/4/22
to vim...@googlegroups.com

Patch 9.0.0138
Problem: Not enough characters accepted for 'spellfile'.
Solution: Add vim_is_fname_char() and use it for 'spellfile'.
Files: src/charset.c, src/proto/charset.pro, src/spell.c,
src/testdir/test_spellfile.vim


*** ../vim-9.0.0137/src/charset.c 2022-08-01 16:50:58.865575303 +0100
--- src/charset.c 2022-08-04 12:58:13.025453481 +0100
***************
*** 225,231 ****
}
else
{
! g_chartab[c] = (g_chartab[c] & ~CT_CELL_MASK) + 1;
g_chartab[c] |= CT_PRINT_CHAR;
}
}
--- 225,232 ----
}
else
{
! g_chartab[c] = (g_chartab[c] & ~CT_CELL_MASK)
! + 1;
g_chartab[c] |= CT_PRINT_CHAR;
}
}
***************
*** 846,853 ****
}

/*
! * return TRUE if 'c' is a valid file-name character
* Assume characters above 0x100 are valid (multi-byte).
*/
int
vim_isfilec(int c)
--- 847,856 ----
}

/*
! * 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,861 ****
--- 859,874 ----
}

/*
+ * 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("]")
*** ../vim-9.0.0137/src/proto/charset.pro 2022-07-25 18:13:33.050580738 +0100
--- src/proto/charset.pro 2022-08-04 12:56:22.305496021 +0100
***************
*** 25,30 ****
--- 25,31 ----
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);
*** ../vim-9.0.0137/src/spell.c 2022-07-04 13:37:03.933167280 +0100
--- src/spell.c 2022-08-04 12:52:37.061517227 +0100
***************
*** 4363,4369 ****
char_u *s;

for (s = val; *s != NUL; ++s)
! if (!vim_isfilec(*s) && *s != ',' && *s != ' ')
return FALSE;
return TRUE;
}
--- 4363,4369 ----
char_u *s;

for (s = val; *s != NUL; ++s)
! if (!vim_is_fname_char(*s))
return FALSE;
return TRUE;
}
*** ../vim-9.0.0137/src/testdir/test_spellfile.vim 2021-11-21 11:32:04.000000000 +0000
--- src/testdir/test_spellfile.vim 2022-08-04 12:57:52.949462464 +0100
***************
*** 1160,1163 ****
--- 1160,1171 ----
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
*** ../vim-9.0.0137/src/version.c 2022-08-03 16:13:24.179412223 +0100
--- src/version.c 2022-08-04 12:56:15.609498010 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 138,
/**/

--
hundred-and-one symptoms of being an internet addict:
241. You try to look for Net Search even when you're in File Manager.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages