]> granicus.if.org Git - vim/commitdiff
patch 7.4.2162 v7.4.2162
authorBram Moolenaar <Bram@vim.org>
Sat, 6 Aug 2016 12:12:50 +0000 (14:12 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 6 Aug 2016 12:12:50 +0000 (14:12 +0200)
Problem:    Result of getcompletion('', 'sign') depends on previous
            completion.
Solution:   Call set_context_in_sign_cmd(). (Dominique Pelle)

src/evalfunc.c
src/testdir/test_cmdline.vim
src/version.c

index dc0e630af88ff18b53c01ec212c7c952a1692d27..37545344606595d1ba32f7b2b9f2990f6cb54b54 100644 (file)
@@ -4247,6 +4247,13 @@ f_getcompletion(typval_T *argvars, typval_T *rettv)
        xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
     }
 #endif
+#ifdef FEAT_SIGNS
+    if (xpc.xp_context == EXPAND_SIGN)
+    {
+       set_context_in_sign_cmd(&xpc, xpc.xp_pattern);
+       xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
+    }
+#endif
 
     pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context);
     if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL))
index 12194cd963873dec09fd6ead6c453781c45fa715..e2c1876934756db80643c90844d34a6c1f07b3c2 100644 (file)
@@ -138,6 +138,19 @@ func Test_getcompletion()
     call assert_equal(keys, l)
   endif
 
+  if has('signs')
+    sign define Testing linehl=Comment
+    let l = getcompletion('', 'sign')
+    let cmds = ['define', 'jump', 'list', 'place', 'undefine', 'unplace']
+    call assert_equal(cmds, l)
+    " using cmdline completion must not change the result
+    call feedkeys(":sign list \<c-d>\<c-c>", 'xt')
+    let l = getcompletion('', 'sign')
+    call assert_equal(cmds, l)
+    let l = getcompletion('list ', 'sign')
+    call assert_equal(['Testing'], l)
+  endif
+
   " For others test if the name is recognized.
   let names = ['buffer', 'environment', 'file_in_path',
        \ 'mapping', 'shellcmd', 'tag', 'tag_listfiles', 'user']
@@ -150,9 +163,6 @@ func Test_getcompletion()
   if has('profile')
     call add(names, 'syntime')
   endif
-  if has('signs')
-    call add(names, 'sign')
-  endif
 
   set tags=Xtags
   call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", "word\tfile\tcmd"], 'Xtags')
index e68df1f5aca36902d97175a422f6e7ff363e4c50..bd2b16c7ab70a116df1f2c47a76589ef2b6e71cc 100644 (file)
@@ -763,6 +763,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2162,
 /**/
     2161,
 /**/