From b2f1969f82ae0f02e480e8d2d5dc46a85eba33db Mon Sep 17 00:00:00 2001 From: erw7 Date: Wed, 24 Feb 2021 13:54:12 +0900 Subject: [PATCH 1/3] option: fix problem with fileignorecase not being set properly --- CMakeLists.txt | 2 ++ config/config.h.in | 1 + 2 files changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e3c67c55cd..4e427eea26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,6 +83,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Darwin") + # Ignore case when comparing filenames on Windows and Mac. + set(CASE_INSENSITIVE_FILENAME TRUE) # Enable fixing case-insensitive filenames for Windows and Mac. set(USE_FNAME_CASE TRUE) endif() diff --git a/config/config.h.in b/config/config.h.in index 95e2c872a3..275bff79a0 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -40,6 +40,7 @@ #cmakedefine HAVE_WORKING_LIBINTL #cmakedefine HAVE_WSL #cmakedefine UNIX +#cmakedefine CASE_INSENSITIVE_FILENAME #cmakedefine USE_FNAME_CASE #cmakedefine HAVE_SYS_UIO_H #ifdef HAVE_SYS_UIO_H From 6deabca3e7da055bc2b26b795f2e2e98b3c70d4e Mon Sep 17 00:00:00 2001 From: erw7 Date: Wed, 24 Feb 2021 15:19:57 +0900 Subject: [PATCH 2/3] eval: add fname_case to feature list --- runtime/doc/eval.txt | 2 ++ src/nvim/eval/funcs.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 22963a372b..be7c026f5a 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -5125,6 +5125,8 @@ has({feature}) Returns 1 if {feature} is supported, 0 otherwise. The iconv Can use |iconv()| for conversion. +shellslash Can use backslashes in filenames (Windows) clipboard |clipboard| provider is available. + fname_case Case in file names matters (for Darwin and MS-Windows + this is not present). mac MacOS system. nvim This is Nvim. python2 Legacy Vim |python2| interface. |has-python| diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 79cb1385ea..8c8e0d568b 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -4131,7 +4131,9 @@ static void f_has(typval_T *argvars, typval_T *rettv, FunPtr fptr) #ifdef _WIN64 "win64", #endif +#ifndef CASE_INSENSITIVE_FILENAME "fname_case", +#endif #ifdef HAVE_ACL "acl", #endif From 34d12e7dd732632d9fa89312aa51203e2a80faf4 Mon Sep 17 00:00:00 2001 From: erw7 Date: Wed, 24 Feb 2021 20:13:01 +0900 Subject: [PATCH 3/3] path.c: fix path_fnamencmp Fix the problem that the last comparison of strings when p_fic is true was not ignore case. --- src/nvim/path.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvim/path.c b/src/nvim/path.c index 2de7e00ddb..3e1713fbdd 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -342,7 +342,7 @@ int path_fnamencmp(const char *const fname1, const char *const fname2, p1 += utfc_ptr2len((const char_u *)p1); p2 += utfc_ptr2len((const char_u *)p2); } - return c1 - c2; + return p_fic ? CH_FOLD(c1) - CH_FOLD(c2) : c1 - c2; #else if (p_fic) { return mb_strnicmp((const char_u *)fname1, (const char_u *)fname2, len);