From e4c4d672b581124da1205a008d44fd278a88d6af Mon Sep 17 00:00:00 2001 From: glepnir Date: Tue, 13 May 2025 14:29:07 +0800 Subject: [PATCH] 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 https://github.com/vim/vim/commit/8d0e42b71023144e6db17534da41ffecbd0b655f --- src/nvim/insexpand.c | 10 +++++++++- test/old/testdir/test_ins_complete.vim | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index 8625c0c1ca..cd5945731d 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -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; diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index 7d2288d97b..9ca8d1661a 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -3775,6 +3775,10 @@ func Test_complete_match() call feedkeys("Sabc, \:let g:result=complete_match()\", 'tx') call assert_equal([[4, ',']], g:result) + set ise=\ ,= + call feedkeys("Sif true \:let g:result=complete_match()\", 'tx') + call assert_equal([[8, ' ']], g:result) + bw! unlet g:result set isexpand&