Merge pull request #13402 from janlazo/vim-8.2.2056

vim-patch:8.1.0951,8.2.{271,594,965,1370,2056,2059}
This commit is contained in:
Jan Edmund Lazo 2020-11-27 21:27:07 -05:00 committed by GitHub
commit ba13b94f5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 53 additions and 63 deletions

View File

@ -4047,7 +4047,7 @@ static void f_has(typval_T *argvars, typval_T *rettv, FunPtr fptr)
#if defined(WIN32)
"win32",
#endif
#if defined(WIN64) || defined(_WIN64)
#ifdef _WIN64
"win64",
#endif
"fname_case",

View File

@ -1333,6 +1333,7 @@ static void load_plugins(void)
{
if (p_lpl) {
char_u *rtp_copy = NULL;
char_u *const plugin_pattern = (char_u *)"plugin/**/*.vim"; // NOLINT
// First add all package directories to 'runtimepath', so that their
// autoload directories can be found. Only if not done already with a
@ -1345,7 +1346,7 @@ static void load_plugins(void)
}
source_in_path(rtp_copy == NULL ? p_rtp : rtp_copy,
(char_u *)"plugin/**/*.vim", // NOLINT
plugin_pattern,
DIP_ALL | DIP_NOAFTER);
TIME_MSG("loading plugins");
xfree(rtp_copy);
@ -1357,7 +1358,7 @@ static void load_plugins(void)
}
TIME_MSG("loading packages");
source_runtime((char_u *)"plugin/**/*.vim", DIP_ALL | DIP_AFTER);
source_runtime(plugin_pattern, DIP_ALL | DIP_AFTER);
TIME_MSG("loading after plugins");
}
}

View File

@ -900,6 +900,7 @@ int vim_vsnprintf_typval(
}
switch (fmt_spec) {
case 'b': case 'B':
case 'd': case 'u': case 'o': case 'x': case 'X':
if (tvs && length_modifier == '\0') {
length_modifier = '2';

View File

@ -125,22 +125,7 @@ func Test_option_value()
endfunc
function Test_printf_64bit()
if has('num64')
call assert_equal("123456789012345", printf('%d', 123456789012345))
endif
endfunc
func Test_setmatches()
hi def link 1 Comment
hi def link 2 PreProc
let set = [{"group": 1, "pattern": 2, "id": 3, "priority": 4}]
let exp = [{"group": '1', "pattern": '2', "id": 3, "priority": 4}]
if has('conceal')
let set[0]['conceal'] = 5
let exp[0]['conceal'] = '5'
endif
call setmatches(set)
call assert_equal(exp, getmatches())
call assert_equal("123456789012345", printf('%d', 123456789012345))
endfunc
function Test_printf_spec_s()
@ -168,6 +153,19 @@ function Test_printf_spec_s()
call assert_equal(string(function('printf', ['%s'])), printf('%s', function('printf', ['%s'])))
endfunc
function Test_printf_spec_b()
call assert_equal("0", printf('%b', 0))
call assert_equal("00001100", printf('%08b', 12))
call assert_equal("11111111", printf('%08b', 0xff))
call assert_equal(" 1111011", printf('%10b', 123))
call assert_equal("0001111011", printf('%010b', 123))
call assert_equal(" 0b1111011", printf('%#10b', 123))
call assert_equal("0B01111011", printf('%#010B', 123))
call assert_equal("1001001100101100000001011010010", printf('%b', 1234567890))
call assert_equal("11100000100100010000110000011011101111101111001", printf('%b', 123456789012345))
call assert_equal("1111111111111111111111111111111111111111111111111111111111111111", printf('%b', -1))
endfunc
function Test_printf_misc()
call assert_equal('123', printf('123'))
call assert_fails("call printf('123', 3)", "E767:")
@ -482,6 +480,19 @@ func Test_funcref()
call assert_fails('let OneByRef = funcref("One", repeat(["foo"], 21))', 'E118:')
endfunc
func Test_setmatches()
hi def link 1 Comment
hi def link 2 PreProc
let set = [{"group": 1, "pattern": 2, "id": 3, "priority": 4}]
let exp = [{"group": '1', "pattern": '2', "id": 3, "priority": 4}]
if has('conceal')
let set[0]['conceal'] = 5
let exp[0]['conceal'] = '5'
endif
call setmatches(set)
call assert_equal(exp, getmatches())
endfunc
func Test_empty_concatenate()
call assert_equal('b', 'a'[4:0] . 'b')
call assert_equal('b', 'b' . 'a'[4:0])

View File

@ -24,11 +24,6 @@ func Test_largefile()
w
" Check if the file size is 4,000,000,000 bytes.
let fsize=getfsize(fname)
if has('num64')
call assert_true(fsize == 4000000000)
else
" getfsize() returns -2 if a Number is 32 bits.
call assert_true(fsize == -2)
endif
call assert_true(fsize == 4000000000)
call delete(fname)
endfunc

View File

@ -1257,9 +1257,8 @@ abc
\ '2147483647'], getline(1, '$'))
bwipe!
if has('num64')
new
a
new
a
-9223372036854775808
-9223372036854775807
@ -1274,22 +1273,21 @@ abc
abc
.
sort n
call assert_equal(['',
\ 'abc',
\ '',
\ '-9223372036854775808',
\ '-9223372036854775808',
\ '-9223372036854775807',
\ '-9223372036854775806',
\ '-1',
\ '0',
\ '1',
\ '9223372036854775806',
\ '9223372036854775807',
\ '9223372036854775807'], getline(1, '$'))
bwipe!
endif
sort n
call assert_equal(['',
\ 'abc',
\ '',
\ '-9223372036854775808',
\ '-9223372036854775808',
\ '-9223372036854775807',
\ '-9223372036854775806',
\ '-1',
\ '0',
\ '1',
\ '9223372036854775806',
\ '9223372036854775807',
\ '9223372036854775807'], getline(1, '$'))
bwipe!
endfunc

View File

@ -1068,10 +1068,6 @@ endfunc
"-------------------------------------------------------------------------------
func Test_num64()
if !has('num64')
return
endif
call assert_notequal( 4294967296, 0)
call assert_notequal(-4294967296, 0)
call assert_equal( 4294967296, 0xFFFFffff + 1)
@ -1313,27 +1309,15 @@ func Test_compound_assignment_operators()
" Test special cases: division or modulus with 0.
let x = 1
let x /= 0
if has('num64')
call assert_equal(0x7FFFFFFFFFFFFFFF, x)
else
call assert_equal(0x7fffffff, x)
endif
call assert_equal(0x7FFFFFFFFFFFFFFF, x)
let x = -1
let x /= 0
if has('num64')
call assert_equal(-0x7FFFFFFFFFFFFFFF, x)
else
call assert_equal(-0x7fffffff, x)
endif
call assert_equal(-0x7FFFFFFFFFFFFFFF, x)
let x = 0
let x /= 0
if has('num64')
call assert_equal(-0x7FFFFFFFFFFFFFFF - 1, x)
else
call assert_equal(-0x7FFFFFFF - 1, x)
endif
call assert_equal(-0x7FFFFFFFFFFFFFFF - 1, x)
let x = 1
let x %= 0