0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

Make :find completion consistent between Unix and MS-Windows. Add a test.

(Nazri Ramliy)
This commit is contained in:
Bram Moolenaar
2010-08-04 17:07:20 +02:00
parent 150a1321b2
commit 80a7dcf8b5
11 changed files with 75 additions and 50 deletions

View File

@@ -2067,6 +2067,36 @@ ga_grow(gap, n)
return OK;
}
/*
* For a growing array that contains a list of strings: concatenate all the
* strings with a separating comma.
* Returns NULL when out of memory.
*/
char_u *
ga_concat_strings(gap)
garray_T *gap;
{
int i;
int len = 0;
char_u *s;
for (i = 0; i < gap->ga_len; ++i)
len += (int)STRLEN(((char_u **)(gap->ga_data))[i]) + 1;
s = alloc(len + 1);
if (s != NULL)
{
*s = NUL;
for (i = 0; i < gap->ga_len; ++i)
{
if (*s != NUL)
STRCAT(s, ",");
STRCAT(s, ((char_u **)(gap->ga_data))[i]);
}
}
return s;
}
/*
* Concatenate a string to a growarray which contains characters.
* Note: Does NOT copy the NUL at the end!