2016-7-24(Sun) 0:36:14 UTC+9 Christian Brabandt:
I have investigated this behavior.
Related vim_dev threads:
- Patch 7.4.2146
https://groups.google.com/d/msg/vim_dev/75ZXlRlBzl4/DDnqvSn9BgAJ
- [vim/vim] VIM 7.4: Possible regression via patch 2146? (#972)
https://groups.google.com/d/msg/vim_dev/mQ2YacpOKvo/vOsgkU-2AQAJ
- Patch 7.4.2188
https://groups.google.com/d/msg/vim_dev/e2Rr8Px3qkQ/1XWiAQ0LAgAJ
I think the series of <C-E> behavior is correct.
>
> (cursor at D, press <f5><c-e><c-e><c-e><c-e><enter>)
>
> Now if you want to complete the letter D this should only complete to
> December, since all other values do not match it and therefore it should
> be completed immediately to December and no menu shown. Therefore,
> pressing <C-e> afterwards should select the letter from below the
> cursors line, so it should complete to "December2015" if you press <c-e>
> 4 times, then there should be a new line because of the enter and then
> the "December2015" should be shown. So in the end, the buffer should
> look like this:
>
> ,----
> | December2015
> |
> | December2015
> `----
"the popup menu is not visible" is not equivalent to "the completion mode is not active".
After the type <F5>, Vim still stay in the first state of the completion mode.
It is not related to the visible of popup menu.
Check on the gdb.
(gdb) p compl_started
$4 = 1
(gdb) p pum_visible()
$5 = 0
So that, the first <C-E> behavior `complete_CTRL-E` is correct.
Of course, the second and more <C-E> is `i_CTRL_E`.
>
> For whatever reason, doing it interactively, this results in:
>
> ,----
> | Dece
> |
> | December2015
> `----
> (because after inserting the match <c-e> is still in popupmenu mode and
> "ends completion and goes back to what was there before selecting a
> match")
>
> However, a total mystery is to me, when the test is run, it will
> complete to
>
> ,----
> | December2015
> | December2015
> | December2015
> `----
Hmm?, I got the following result. (make test_popup in 7.4.2358)
1 FAILED:
Found errors in Test_popup_complete2():
function RunTheTest[9]..Test_popup_complete2 line 10: Expected ['December2015', '', 'December2015'] but got ['Dece', '', 'December2015']
I think `['Dece', '', 'December2015']` is right.
>
> I have left this documented in the test. I am pretty sure, this is a
> bug, and therefore, the test fails currently.
>
> On a related note, since the "noinsert/noselect" property only seem to
> change, what is inserted when the completion menu is entered initially,
>
> It is hard to correctly test for that, therefore, I basically tested,
> whether enter will insert a line break or not (difference in the states
> as you explained above) and by that we know, if there was something
> selected.
--
Best regards,
Hirohito Higashi (a.k.a. h_east)