vim-patch:9.1.1383: completion: 'isexpand' option does not handle space char correct (#33999)

Problem:  When a space character is used as a trigger in 'isexpand' option
          it doesn't get recognized because skip_to_option_part() skips
          spaces after a comma, treating them as option separators
          rather than option value (after v9.1.1341)
Solution: manually set the part to a space character (glepnir).

closes: vim/vim#17305

8d0e42b710
This commit is contained in:
glepnir
2025-05-13 14:29:07 +08:00
committed by GitHub
parent cc6ee59f5a
commit e4c4d672b5
2 changed files with 13 additions and 1 deletions

View File

@ -3147,7 +3147,15 @@ void f_complete_match(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
char *cur_end = before_cursor + (int)strlen(before_cursor);
while (*p != NUL) {
size_t len = copy_option_part(&p, part, MAXPATHL, ",");
size_t len = 0;
if (*p == ',' && *(p + 1) == ' ' && (*(p + 2) == ',' || *(p + 2) == NUL)) {
part[0] = ' ';
len = 1;
p++;
} else {
len = copy_option_part(&p, part, MAXPATHL, ",");
}
if (len > 0 && (int)len <= col) {
if (strncmp(cur_end - len, part, len) == 0) {
int bytepos = col - (int)len;

View File

@ -3775,6 +3775,10 @@ func Test_complete_match()
call feedkeys("Sabc, \<ESC>:let g:result=complete_match()\<CR>", 'tx')
call assert_equal([[4, ',']], g:result)
set ise=\ ,=
call feedkeys("Sif true \<ESC>:let g:result=complete_match()\<CR>", 'tx')
call assert_equal([[8, ' ']], g:result)
bw!
unlet g:result
set isexpand&