Segfaults on omnifunc completions with "set completeopt+=longest"

52 views
Skip to first unread message

nsf

unread,
Sep 2, 2011, 7:10:26 AM9/2/11
to vim...@googlegroups.com
It looks like someone has changed the logic of the longest match in vim
autocompletion. Now it tries to do the longest match after each new
letter entered. And there are some ugly bugs which causes it to
segfault the vim. Not mentioning that it's also very slow now. Looks
like it calls omnifunc with every character entered.

Probably this commit causes the problem:
http://code.google.com/p/vim/source/detail?r=44ffd0a8abcdba441216514cb711649eb1169876

Vim version: 7.3.289
Looks like it only appears when "set completeopt+=longest" is set.

Steps to reproduce: it's very easy to reproduce this bug with the
option mentioned above + one of my omnifunc plugins: ccode (C/C++
completion based on clang) or gocode (Go completion). Both worked just
fine with previous version of vim + the interaction with vim is
minimal, therefore they shouldn't really cause a segfault by themselves.

Bug appears on both x86 and amd64. Plus confirmed by at least one other
person.

Sergey Khorev

unread,
Sep 5, 2011, 1:01:10 PM9/5/11
to vim...@googlegroups.com
> It looks like someone has changed the logic of the longest match in vim
> autocompletion. Now it tries to do the longest match after each new
> letter entered. And there are some ugly bugs which causes it to
> segfault the vim. Not mentioning that it's also very slow now. Looks
> like it calls omnifunc with every character entered.
>
> Probably this commit causes the problem:
> http://code.google.com/p/vim/source/detail?r=44ffd0a8abcdba441216514cb711649eb1169876

Yes, the motivation behind this patch looks somewhat counter-intuitive
(http://groups.google.com/group/vim_dev/browse_thread/thread/86643b0112664dfe)
Why on Earth a completion of "a" would be "foo1", "foo2", "foo3" but
"bar1", "bar2", "bar3" for "ab"?
If there really is a reason to behave like that we'd better to
implement this somehow else. E.g., the completion function could
return an extra value which says that the function wants to be invoked
every time a user types a letter.

--
Sergey Khorev
http://sites.google.com/site/khorser
Can anybody think of a good tagline I can steal?

Bram Moolenaar

unread,
Sep 5, 2011, 2:13:59 PM9/5/11
to nsf, vim...@googlegroups.com

Some guy calling himself no.snile.face wrote:

[BTW: please use your real name on this maillist]

I'll revert the patch for now. There should be a better solution for
the original problem.

--
BEDEVERE: And that, my lord, is how we know the Earth to be banana-shaped.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Reply all
Reply to author
Forward
0 new messages