aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 1636b490d5..124d6acfe9 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -8728,10 +8728,10 @@ static void f_foldtextresult(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
fold_count = foldedCount(curwin, lnum, &foldinfo);
if (fold_count > 0) {
- text = get_foldtext(curwin, lnum, lnum + fold_count - 1,
- &foldinfo, buf);
- if (text == buf)
+ text = get_foldtext(curwin, lnum, lnum + fold_count - 1, &foldinfo, buf);
+ if (text == buf) {
text = vim_strsave(text);
+ }
rettv->vval.v_string = text;
}
}
@@ -16436,7 +16436,12 @@ static void f_taglist(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
- (void)get_tags(tv_list_alloc_ret(rettv), (char_u *)tag_pattern);
+ const char *fname = NULL;
+ if (argvars[1].v_type != VAR_UNKNOWN) {
+ fname = tv_get_string(&argvars[1]);
+ }
+ (void)get_tags(tv_list_alloc_ret(rettv), (char_u *)tag_pattern,
+ (char_u *)fname);
}
/*