Skip to content

Commit c71807d

Browse files
committed
patch 8.0.1557: printf() does not work with only one argument
Problem: printf() does not work with only one argument. (Daniel Hahler) Solution: Allow using just the format. (Ken Takata, closes #2687)
1 parent 590ec87 commit c71807d

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/evalfunc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ static struct fst
738738
{"pow", 2, 2, f_pow},
739739
#endif
740740
{"prevnonblank", 1, 1, f_prevnonblank},
741-
{"printf", 2, 19, f_printf},
741+
{"printf", 1, 19, f_printf},
742742
{"pumvisible", 0, 0, f_pumvisible},
743743
#ifdef FEAT_PYTHON3
744744
{"py3eval", 1, 1, f_py3eval},

src/testdir/test_expr.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ func Test_option_value()
131131
endfunc
132132

133133
function Test_printf_misc()
134+
call assert_equal('123', printf('123'))
135+
call assert_fails("call printf('123', 3)", "E767:")
136+
134137
call assert_equal('123', printf('%d', 123))
135138
call assert_equal('123', printf('%i', 123))
136139
call assert_equal('123', printf('%D', 123))

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,8 @@ static char *(features[]) =
778778

779779
static int included_patches[] =
780780
{ /* Add new patch number below this line */
781+
/**/
782+
1557,
781783
/**/
782784
1556,
783785
/**/

0 commit comments

Comments
 (0)