summaryrefslogtreecommitdiff
path: root/src/evalfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-03-21 17:09:10 +0100
committerBram Moolenaar <Bram@vim.org>2017-03-21 17:09:10 +0100
commitc6aafbaf3ea755e3ab4ee2e3045911126a08b038 (patch)
treed2a2ea57ffe7e8969d16c3d7423d53acd6e14b04 /src/evalfunc.c
parente94260f3582cf928cc59e792b3b6ede57794a4a6 (diff)
downloadvim-c6aafbaf3ea755e3ab4ee2e3045911126a08b038.zip
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Problem: taglist() does not prioritize tags for a buffer. Solution: Add an optional buffer argument. (Duncan McDougall, closes #1194)
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r--src/evalfunc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 5dc7f8273..8869810df 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -824,7 +824,7 @@ static struct fst
{"tabpagenr", 0, 1, f_tabpagenr},
{"tabpagewinnr", 1, 2, f_tabpagewinnr},
{"tagfiles", 0, 0, f_tagfiles},
- {"taglist", 1, 1, f_taglist},
+ {"taglist", 1, 2, f_taglist},
#ifdef FEAT_FLOAT
{"tan", 1, 1, f_tan},
{"tanh", 1, 1, f_tanh},
@@ -3589,7 +3589,8 @@ f_foldtextresult(typval_T *argvars UNUSED, typval_T *rettv)
fold_count = foldedCount(curwin, lnum, &foldinfo);
if (fold_count > 0)
{
- text = get_foldtext(curwin, lnum, lnum + fold_count - 1, &foldinfo, buf);
+ text = get_foldtext(curwin, lnum, lnum + fold_count - 1,
+ &foldinfo, buf);
if (text == buf)
text = vim_strsave(text);
rettv->vval.v_string = text;
@@ -12267,6 +12268,7 @@ f_tagfiles(typval_T *argvars UNUSED, typval_T *rettv)
static void
f_taglist(typval_T *argvars, typval_T *rettv)
{
+ char_u *fname = NULL;
char_u *tag_pattern;
tag_pattern = get_tv_string(&argvars[0]);
@@ -12275,8 +12277,10 @@ f_taglist(typval_T *argvars, typval_T *rettv)
if (*tag_pattern == NUL)
return;
+ if (argvars[1].v_type != VAR_UNKNOWN)
+ fname = get_tv_string(&argvars[1]);
if (rettv_list_alloc(rettv) == OK)
- (void)get_tags(rettv->vval.v_list, tag_pattern);
+ (void)get_tags(rettv->vval.v_list, tag_pattern, fname);
}
/*