mirror of
https://github.com/vim/vim
synced 2025-07-16 09:12:00 +00:00
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 <basilisk@internode.on.net> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
4ec93fec12
commit
10f69298b4
@ -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;
|
||||
|
@ -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\tFLO\t-in",
|
||||
\ "!VAR\tFLO\t-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
|
||||
|
@ -704,6 +704,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1300,
|
||||
/**/
|
||||
1299,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user