patch 9.1.1300: wrong detection of -inf Commit: https://github.com/vim/vim/commit/10f69298b4577b3712eedeb49b4d9ad1a69111f8 Author: John Marriott <basil...@internode.on.net> Date: Mon Apr 14 21:19:34 2025 +0200
patch 9.1.1300: wrong detection of -inf Problem: wrong detection of -inf Solution: correctly compare 4 characters and not 3 (John Marriott) closes: #17109 Signed-off-by: John Marriott <basil...@internode.on.net> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/float.c b/src/float.c index 9e8074de8..4c8e5fe10 100644 --- a/src/float.c +++ b/src/float.c @@ -41,7 +41,7 @@ string2float( *value = INFINITY; return 3; } - if (STRNICMP(text, "-inf", 3) == 0) + if (STRNICMP(text, "-inf", 4) == 0) { *value = -INFINITY; return 4; diff --git a/src/testdir/test_viminfo.vim b/src/testdir/test_viminfo.vim index 7aab27133..2bbca3e5d 100644 --- a/src/testdir/test_viminfo.vim +++ b/src/testdir/test_viminfo.vim @@ -1329,4 +1329,30 @@ func Test_viminfo_oldfiles_filter() let &viminfofile = _viminfofile endfunc +func Test_viminfo_global_var() + let _viminfofile = &viminfofile + let _viminfo = &viminfo + let &viminfofile='' + set viminfo+=! + let lines = [ + \ '# comment line', + \ "", + \ '# Viminfo version', + \ '|1,4', + \ "", + \ '*encoding=utf-8', + \ "", + \ '# global variables:', + \ "!VAL FLO -in", + \ "!VAR FLO -inf", + \ "", + \ ] + call writefile(lines, 'Xviminfo2', 'D') + rviminfo! Xviminfo2 + call assert_equal(0.0, g:VAL) + call assert_equal(str2float("-inf"), g:VAR) + let &viminfofile = _viminfofile + let &viminfo = _viminfo +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index e4a0b0ed1..0a5b4ecf5 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1300, /**/ 1299, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1u4PVT-0032rG-Ki%40256bit.org.