vim-patch:9.1.1389: completion: still some issue when 'isexpand' contains a space (#34026)

Problem:  Cannot get completion startcol when space is not the first
          trigger character (after v9.1.1383)
Solution: Detect the next comma followed by a space in the option string
          and use in next compare loop (glepnir)

closes: vim/vim#17311

08db2f4f28
This commit is contained in:
glepnir
2025-05-15 14:15:29 +08:00
committed by GitHub
parent d25eb246ef
commit f2aec4bc05
2 changed files with 16 additions and 4 deletions

View File

@ -3144,15 +3144,20 @@ void f_complete_match(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
}
} else {
char *p = ise;
char *p_space = NULL;
char *cur_end = before_cursor + (int)strlen(before_cursor);
while (*p != NUL) {
size_t len = 0;
if (*p == ',' && *(p + 1) == ' ' && (*(p + 2) == ',' || *(p + 2) == NUL)) {
part[0] = ' ';
len = 1;
p++;
if (p_space) {
len = (size_t)(p - p_space - 1);
memcpy(part, p_space + 1, len);
p_space = NULL;
} else {
char *next_comma = strchr((*p == ',') ? p + 1 : p, ',');
if (next_comma && *(next_comma + 1) == ' ') {
p_space = next_comma;
}
len = copy_option_part(&p, part, MAXPATHL, ",");
}