0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.0988: getting directory contents is always case sorted

Problem:    Getting directory contents is always case sorted.
Solution:   Add sort options and v:collate. (Christian Brabandt, closes #6229)
This commit is contained in:
Bram Moolenaar
2020-06-16 20:03:43 +02:00
parent 9af78769ee
commit 84cf6bd81b
17 changed files with 272 additions and 32 deletions

View File

@@ -1599,6 +1599,11 @@ void *vim_memset(void *, int, size_t);
# define STRICMP(d, s) vim_stricmp((char *)(d), (char *)(s))
# endif
#endif
#ifdef HAVE_STRCOLL
# define STRCOLL(d, s) strcoll((char *)(d), (char *)(s))
#else
# define STRCOLL(d, s) strcmp((char *)(d), (char *)(s))
#endif
// Like strcpy() but allows overlapped source and destination.
#define STRMOVE(d, s) mch_memmove((d), (s), STRLEN(s) + 1)
@@ -1896,7 +1901,7 @@ typedef int sock_T;
#define VALID_PATH 1
#define VALID_HEAD 2
// Defines for Vim variables. These must match vimvars[] in eval.c!
// Defines for Vim variables. These must match vimvars[] in evalvars.c!
#define VV_COUNT 0
#define VV_COUNT1 1
#define VV_PREVCOUNT 2
@@ -1992,7 +1997,8 @@ typedef int sock_T;
#define VV_VERSIONLONG 92
#define VV_ECHOSPACE 93
#define VV_ARGV 94
#define VV_LEN 95 // number of v: vars
#define VV_COLLATE 95
#define VV_LEN 96 // number of v: vars
// used for v_number in VAR_BOOL and VAR_SPECIAL
#define VVAL_FALSE 0L // VAR_BOOL
@@ -2669,4 +2675,10 @@ long elapsed(DWORD start_tick);
#define FSK_IN_STRING 0x04 // TRUE in string, double quote is escaped
#define FSK_SIMPLIFY 0x08 // simplify <C-H> and <A-x>
// Flags for the readdirex function, how to sort the result
#define READDIR_SORT_NONE 0 // do not sort
#define READDIR_SORT_BYTE 1 // sort by byte order (strcmp), default
#define READDIR_SORT_IC 2 // sort ignoring case (strcasecmp)
#define READDIR_SORT_COLLATE 3 // sort according to collation (strcoll)
#endif // VIM__H