summaryrefslogtreecommitdiff
path: root/src/evalbuffer.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-01-31 13:08:38 +0100
committerBram Moolenaar <Bram@vim.org>2021-01-31 13:08:38 +0100
commit3445320839a38b3b0c253513b125da8298ec27d6 (patch)
tree36de5f4e0a019c497710a3cfd6908a5fed0feed4 /src/evalbuffer.c
parentf2b26bcf8f498fed72759af4aa768fb2aab3118c (diff)
downloadvim-git-3445320839a38b3b0c253513b125da8298ec27d6.tar.gz
patch 8.2.2435: setline() gives an error for some typesv8.2.2435
Problem: setline() gives an error for some types. Solution: Allow any type, convert each item to a string.
Diffstat (limited to 'src/evalbuffer.c')
-rw-r--r--src/evalbuffer.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/evalbuffer.c b/src/evalbuffer.c
index 3fed3893e..2ba2f679a 100644
--- a/src/evalbuffer.c
+++ b/src/evalbuffer.c
@@ -128,7 +128,8 @@ find_win_for_curbuf(void)
}
/*
- * Set line or list of lines in buffer "buf".
+ * Set line or list of lines in buffer "buf" to "lines".
+ * Any type is allowed and converted to a string.
*/
static void
set_buffer_lines(
@@ -187,7 +188,7 @@ set_buffer_lines(
li = l->lv_first;
}
else
- line = tv_get_string_chk(lines);
+ line = typval_tostring(lines, FALSE);
// default result is zero == OK
for (;;)
@@ -197,7 +198,8 @@ set_buffer_lines(
// list argument, get next string
if (li == NULL)
break;
- line = tv_get_string_chk(&li->li_tv);
+ vim_free(line);
+ line = typval_tostring(&li->li_tv, FALSE);
li = li->li_next;
}
@@ -238,6 +240,7 @@ set_buffer_lines(
break;
++lnum;
}
+ vim_free(line);
if (added > 0)
{