diff options
-rw-r--r-- | src/nvim/mbyte.c | 6 | ||||
-rw-r--r-- | src/nvim/path.c | 3 | ||||
-rw-r--r-- | src/nvim/testdir/test_autochdir.vim | 10 |
3 files changed, 17 insertions, 2 deletions
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index e5fa80a242..f634c7dda8 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -1317,6 +1317,12 @@ bool mb_isupper(int a) return mb_tolower(a) != a; } +bool mb_isalpha(int a) + FUNC_ATTR_WARN_UNUSED_RESULT +{ + return mb_islower(a) || mb_isupper(a); +} + static int utf_strnicmp(const char_u *s1, const char_u *s2, size_t n1, size_t n2) { int c1, c2, cdiff; diff --git a/src/nvim/path.c b/src/nvim/path.c index 7f7f941e26..d3aa5e5bf2 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -642,8 +642,7 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, size_t wildoff, } else if (path_end >= path + wildoff && (vim_strchr((char_u *)"*?[{~$", *path_end) != NULL #ifndef WIN32 - || (!p_fic && (flags & EW_ICASE) - && isalpha(utf_ptr2char(path_end))) + || (!p_fic && (flags & EW_ICASE) && mb_isalpha(utf_ptr2char(path_end))) #endif )) { e = p; diff --git a/src/nvim/testdir/test_autochdir.vim b/src/nvim/testdir/test_autochdir.vim index 9ad727241e..a012541c0d 100644 --- a/src/nvim/testdir/test_autochdir.vim +++ b/src/nvim/testdir/test_autochdir.vim @@ -64,4 +64,14 @@ func Test_verbose_pwd() call delete('Xautodir', 'rf') endfunc +func Test_multibyte() + " using an invalid character should not cause a crash + set wic + " E344 is thrown first, but v8.1.1183 hasn't been ported yet + " call assert_fails('tc *', 'E344:') + call assert_fails('tc *', 'E472:') + set nowic +endfunc + + " vim: shiftwidth=2 sts=2 expandtab |