#1142936 vim-youcompleteme: Test_Select_Next_Previous_InsertModeMapping in upstream-vim-tests/completion*.vim fails with recent Vim

#1142936#5
Date:
2026-07-28 11:18:44 UTC
From:
To:
The completion.test.vim, completion_info.test.vim, and
completion_noresolve.test.vim autopkgtests all fail like below:

Found errors in Test_Select_Next_Previous_InsertModeMapping(). Retrying.
command line..script /tmp/autopkgtest-lxc.tg7g_8lw/downtmp/build.1jz/src/test/lib/run_test.vim[387]..function RunTheTest[68]..Test_Select_Next_Previous_InsertModeMapping[52]..FeedAndCheckMain[2]..Check2[2]..CheckCurrentLine line 1: Expected '  foo.c' but got '  foo.'
command line..script /tmp/autopkgtest-lxc.tg7g_8lw/downtmp/build.1jz/src/test/lib/run_test.vim[387]..function RunTheTest[68]..Test_Select_Next_Previous_InsertModeMapping[52]..FeedAndCheckMain[2]..Check3[2]..CheckCurrentLine line 1: Expected '  foo.x' but got '  foo.'
command line..script /tmp/autopkgtest-lxc.tg7g_8lw/downtmp/build.1jz/src/test/lib/run_test.vim[387]..function RunTheTest[68]..Test_Select_Next_Previous_InsertModeMapping[52]..FeedAndCheckMain[2]..Check4[1]..CheckCurrentLine line 1: Expected '  foo.a' but got '  fooa'

I haven't had time yet to try and bisect which patch changed the
behavior.

#1142936#10
Date:
2026-07-29 07:37:14 UTC
From:
To:
Am Tue, Jul 28, 2026 at 07:18:44AM -0400, schrieb James McCoy:

They use all the shared `test/completion.common.vim` that contains
the failing test, so that seems expected. I can also confirm that
2:9.2.0858-1 (current sid) & 2:9.2.0782-1 (previous sid) exhibit
this behaviour while 2:9.2.0524-1+b1 (current testing) does not.

The test is the same as another one that works just fine except
that it inoremap's <C-n> to <Down>. The test triggers the
completion popup (that offers the choices c, x & a as they are
member variables of the foo struct, but whatever) by writing '.'.
Pressing "next" in the form of <Tab>, <Down> or even default <C-n>
selects the first/next item in the completion choice and crucially
writes the choice to the line as well.

The later does not happen anymore with the remap of <C-n>,
but only for <C-n>. <Down> directly works as before.
That seems like a very odd behaviour change…

I am not quite sure what the point of this exercise is through
and the upstream commit adding the test isn't enlightening me[0].
It seems to not effect anything big at least, so if it helps I can
disable the test for now so the CVE fixes and/or perl can pass on
to testing and worry about this at a later point in time… ?


Attached is a stripped down version of the test; it still needs
vim-youcompleteme as well as the basic.c file from the source to run
as I don't know how to convince Omni completion to spawn if I remap
the keycombo to spawn it… If that isn't telling enough, looking at
the script, you will notice immediately what a pro I am at this… 😳

$ vim -Nu vimrc_ycm_minimal.vim debian/tests/data/basic.cpp

(Disclaimer: No LLMs were harmed in the process.)


Best regards

David Kalnischkies

[0] https://github.com/ycm-core/YouCompleteMe/commit/6f252b3419d15c7787794d839a32a2703d249b89

#1142936#15
Date:
2026-08-03 05:54:45 UTC
From:
To:
Control: severity -1 serious

This is already in the archive and blocking vim from migrating to testing, thus
raising the severity to RC.

Cheers,
Emilio

#1142936#22
Date:
2026-08-03 13:14:50 UTC
From:
To:
Am Wed, Jul 29, 2026 at 09:37:14AM +0200, schrieb David Kalnischkies:

I still think its an odd change and wonder what caused it, but it seems
in line with what happens in the 'normal' OmniComplete (in all 3 tested
versions of vim) that the line isn't changed on a remapped <C-n>
(my feeble attempt at reproducing this in bare vim attached).

So in some sense this change in behavior is aligning it closer to how
vim itself behaves… except that it is explicitly tested to not behave
this way in their tests…

I still believe that this is an odd behaviour change triggered by
vim, so investigating it eventually would be nice, but to remove
the pressure on what seems rather minor of an issue, I will disable
the failing test for now as suggested previously
(just uploaded, should be available in a short while).


Best regards

David Kalnischkies

#1142936#29
Date:
2026-08-04 00:54:03 UTC
From:
To:
Thanks for the repro script. That was very helpful.

The problematic commit is

commit 076585e6addb5688f123ef3e174fcfee993b7602 (tag: v9.2.0624)
Author: Thomas M Kehrenberg <tmke8@posteo.net>
Date:   Sat Jun 13 14:36:58 2026 +0000

     patch 9.2.0624: C-N/C-P cannot be mapped in complete() completion

     Problem:  Keys valid in CTRL-X mode are never mapped while insert
               completion is active, so <C-N> and <C-P> cannot be remapped
               for completion started by complete().
     Solution: Do not disable mappings in CTRL_X_EVAL mode.  In this mode a
               mapping cannot interfere with selecting the completion
               method, which is what the no-mapping rule exists for.

     related: #6440
     related: #16880
     closes:  #20489

So, this is an intentional relaxing of behavior to allow remapping. I
think skipping the tests is correct, since the behavior being tested has
changed.

Cheers,