aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/eval.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index e15d6c0240..124d6acfe9 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -8729,8 +8729,9 @@ 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)
+ if (text == buf) {
text = vim_strsave(text);
+ }
rettv->vval.v_string = text;
}
}