From: glepnir Date: Sun, 28 Jun 2026 16:51:26 +0000 (+0000) Subject: patch 9.2.0741: complete_check() does not return TRUE for mapped input X-Git-Tag: v9.2.0741^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37d85f5f1ad336fdc63e949c3b2db8ae7be618e4;p=thirdparty%2Fvim.git patch 9.2.0741: complete_check() does not return TRUE for mapped input Problem: Mapped typed keys didn't interrupt completion in complete_check() (Yikai Zhao) Solution: Also interrupt when in_compl_func and not replaying a register. (glepnir) closes: #5547 closes: #20643 Signed-off-by: glepnir Signed-off-by: Christian Brabandt --- diff --git a/src/insexpand.c b/src/insexpand.c index 0361d9a6e7..75e55a60eb 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -6408,9 +6408,10 @@ ins_compl_check_keys(int frequency, int in_compl_func) c = safe_vgetc(); if (c != K_IGNORE) { - // Don't interrupt completion when the character wasn't typed, - // e.g., when doing @q to replay keys. - if (c != Ctrl_R && KeyTyped) + // Typed keys that get mapped lose KeyTyped. Still let + // complete_check() interrupt, except during @r replay. + if (c != Ctrl_R && (KeyTyped + || (in_compl_func && reg_executing == 0))) compl_interrupted = TRUE; vungetc(c); diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim index d4298aeb96..00fcf4e44d 100644 --- a/src/testdir/test_ins_complete.vim +++ b/src/testdir/test_ins_complete.vim @@ -6535,4 +6535,32 @@ func Test_call_complete_while_filtering() bwipe! endfunc +func Test_complete_check_mapped_typed_key() + func SlowComplete(findstart, base) + if a:findstart + return col('.') - 1 + endif + call complete_add('foobar') + let g:compl_iterations = 0 + while !complete_check() && g:compl_iterations < 100 + let g:compl_iterations += 1 + sleep 5m + endwhile + return [] + endfunc + + new + setlocal completefunc=SlowComplete + setlocal completeopt=menuone,noselect + inoremap + + let g:compl_iterations = -1 + call feedkeys("Sfoo\\ \", 'tx') + call assert_inrange(0, 99, g:compl_iterations) + + bwipe! + delfunc SlowComplete + unlet g:compl_iterations +endfunc + " vim: shiftwidth=2 sts=2 expandtab nofoldenable diff --git a/src/version.c b/src/version.c index 1231556601..ebe7f97093 100644 --- a/src/version.c +++ b/src/version.c @@ -759,6 +759,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 741, /**/ 740, /**/