Skip to content

Commit 7522f69

Browse files
committed
patch 7.4.2162
Problem: Result of getcompletion('', 'sign') depends on previous completion. Solution: Call set_context_in_sign_cmd(). (Dominique Pelle)
1 parent 7ab6def commit 7522f69

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

src/evalfunc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4247,6 +4247,13 @@ f_getcompletion(typval_T *argvars, typval_T *rettv)
42474247
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
42484248
}
42494249
#endif
4250+
#ifdef FEAT_SIGNS
4251+
if (xpc.xp_context == EXPAND_SIGN)
4252+
{
4253+
set_context_in_sign_cmd(&xpc, xpc.xp_pattern);
4254+
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
4255+
}
4256+
#endif
42504257

42514258
pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context);
42524259
if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL))

src/testdir/test_cmdline.vim

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,19 @@ func Test_getcompletion()
138138
call assert_equal(keys, l)
139139
endif
140140

141+
if has('signs')
142+
sign define Testing linehl=Comment
143+
let l = getcompletion('', 'sign')
144+
let cmds = ['define', 'jump', 'list', 'place', 'undefine', 'unplace']
145+
call assert_equal(cmds, l)
146+
" using cmdline completion must not change the result
147+
call feedkeys(":sign list \<c-d>\<c-c>", 'xt')
148+
let l = getcompletion('', 'sign')
149+
call assert_equal(cmds, l)
150+
let l = getcompletion('list ', 'sign')
151+
call assert_equal(['Testing'], l)
152+
endif
153+
141154
" For others test if the name is recognized.
142155
let names = ['buffer', 'environment', 'file_in_path',
143156
\ 'mapping', 'shellcmd', 'tag', 'tag_listfiles', 'user']
@@ -150,9 +163,6 @@ func Test_getcompletion()
150163
if has('profile')
151164
call add(names, 'syntime')
152165
endif
153-
if has('signs')
154-
call add(names, 'sign')
155-
endif
156166

157167
set tags=Xtags
158168
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", "word\tfile\tcmd"], 'Xtags')

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ static char *(features[]) =
763763

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
2162,
766768
/**/
767769
2161,
768770
/**/

0 commit comments

Comments
 (0)