0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.2948: substitute() accepts a number but not a float expression

Problem:    Substitute() accepts a number but not a float expression.
Solution:   Also accept a float. (closes #8331)
This commit is contained in:
Bram Moolenaar
2021-06-06 12:33:49 +02:00
parent f5bfa8faa7
commit 7a2217bedd
3 changed files with 17 additions and 2 deletions

View File

@@ -462,8 +462,13 @@ tv_get_string_buf_chk_strict(typval_T *varp, char_u *buf, int strict)
break;
case VAR_FLOAT:
#ifdef FEAT_FLOAT
emsg(_(e_float_as_string));
break;
if (strict)
{
emsg(_(e_float_as_string));
break;
}
vim_snprintf((char *)buf, NUMBUFLEN, "%g", varp->vval.v_float);
return buf;
#endif
case VAR_STRING:
if (varp->vval.v_string != NULL)