summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-03-03 15:06:52 +0100
committerBram Moolenaar <Bram@vim.org>2018-03-03 15:06:52 +0100
commitc71807db9c1821baf86796cd76952df36ff1a29a (patch)
treeda3e80c8b182e69e254044783949078388676161
parent590ec878a52b3b3d4453475f1eb4899f2b37969f (diff)
downloadvim-git-c71807db9c1821baf86796cd76952df36ff1a29a.tar.gz
patch 8.0.1557: printf() does not work with only one argumentv8.0.1557
Problem: printf() does not work with only one argument. (Daniel Hahler) Solution: Allow using just the format. (Ken Takata, closes #2687)
-rw-r--r--src/evalfunc.c2
-rw-r--r--src/testdir/test_expr.vim3
-rw-r--r--src/version.c2
3 files changed, 6 insertions, 1 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 5b684bd94..e866f4ce1 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -738,7 +738,7 @@ static struct fst
{"pow", 2, 2, f_pow},
#endif
{"prevnonblank", 1, 1, f_prevnonblank},
- {"printf", 2, 19, f_printf},
+ {"printf", 1, 19, f_printf},
{"pumvisible", 0, 0, f_pumvisible},
#ifdef FEAT_PYTHON3
{"py3eval", 1, 1, f_py3eval},
diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim
index c47bc228b..c14b6e671 100644
--- a/src/testdir/test_expr.vim
+++ b/src/testdir/test_expr.vim
@@ -131,6 +131,9 @@ func Test_option_value()
endfunc
function Test_printf_misc()
+ call assert_equal('123', printf('123'))
+ call assert_fails("call printf('123', 3)", "E767:")
+
call assert_equal('123', printf('%d', 123))
call assert_equal('123', printf('%i', 123))
call assert_equal('123', printf('%D', 123))
diff --git a/src/version.c b/src/version.c
index e1f406a43..7d5418592 100644
--- a/src/version.c
+++ b/src/version.c
@@ -779,6 +779,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1557,
+/**/
1556,
/**/
1555,