changeset 9638:af0d98d8836e v7.4.2096

commit https://github.com/vim/vim/commit/b49edc11a1872fa99befa9a4a8ea6c8537868038 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 23 15:47:34 2016 +0200 patch 7.4.2096 Problem: Lambda functions show up with completion. Solution: Don't show lambda functions. (Ken Takata)
author Christian Brabandt <cb@256bit.org>
date Sat, 23 Jul 2016 16:00:06 +0200
parents 75c25d1de77e
children 119fa0edfdd7
files src/testdir/test_cmdline.vim src/userfunc.c src/version.c
diffstat 3 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -69,6 +69,11 @@ func Test_getcompletion()
   let l = getcompletion('tag', 'function')
   call assert_true(index(l, 'taglist(') >= 0)
 
+  let Flambda = {-> 'hello'}
+  let l = getcompletion('', 'function')
+  let l = filter(l, {i, v -> v =~ 'lambda'})
+  call assert_equal(0, len(l))
+
   let l = getcompletion('run', 'file')
   call assert_true(index(l, 'runtest.vim') >= 0)
 
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -2554,8 +2554,9 @@ get_user_func_name(expand_T *xp, int idx
 	    ++hi;
 	fp = HI2UF(hi);
 
-	if (fp->uf_flags & FC_DICT)
-	    return (char_u *)""; /* don't show dict functions */
+	if ((fp->uf_flags & FC_DICT)
+				|| STRNCMP(fp->uf_name, "<lambda>", 8) == 0)
+	    return (char_u *)""; /* don't show dict and lambda functions */
 
 	if (STRLEN(fp->uf_name) + 4 >= IOSIZE)
 	    return fp->uf_name;	/* prevents overflow */
--- 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 */
 /**/
+    2096,
+/**/
     2095,
 /**/
     2094,