Merge pull request #21477 from zeertzjq/vim-9.0.1078

vim-patch:9.0.{1078,1079}
This commit is contained in:
zeertzjq
2022-12-20 07:48:52 +08:00
committed by GitHub
4 changed files with 34 additions and 3 deletions

View File

@@ -378,7 +378,7 @@ int get_indent_lnum(linenr_T lnum)
int get_indent_buf(buf_T *buf, linenr_T lnum) int get_indent_buf(buf_T *buf, linenr_T lnum)
{ {
return get_indent_str_vtab(ml_get_buf(buf, lnum, false), return get_indent_str_vtab(ml_get_buf(buf, lnum, false),
curbuf->b_p_ts, buf->b_p_ts,
buf->b_p_vts_array, buf->b_p_vts_array,
false); false);
} }

View File

@@ -157,6 +157,27 @@ func Test_indent_fold_max()
bw! bw!
endfunc endfunc
func Test_indent_fold_tabstop()
call setline(1, ['0', ' 1', ' 1', "\t2", "\t2"])
setlocal shiftwidth=4
setlocal foldcolumn=1
setlocal foldlevel=2
setlocal foldmethod=indent
redraw
call assert_equal('2 2', ScreenLines(5, 10)[0])
vsplit
windo diffthis
botright new
" This 'tabstop' value should not be used for folding in other buffers.
setlocal tabstop=4
diffoff!
redraw
call assert_equal('2 2', ScreenLines(5, 10)[0])
bwipe!
bwipe!
endfunc
func Test_manual_fold_with_filter() func Test_manual_fold_with_filter()
CheckExecutable cat CheckExecutable cat
for type in ['manual', 'marker'] for type in ['manual', 'marker']

View File

@@ -323,6 +323,11 @@ func Test_CmdErrors()
call assert_fails('com DoCmd :', 'E174:') call assert_fails('com DoCmd :', 'E174:')
comclear comclear
call assert_fails('delcom DoCmd', 'E184:') call assert_fails('delcom DoCmd', 'E184:')
" These used to leak memory
call assert_fails('com! -complete=custom,CustomComplete _ :', 'E182:')
call assert_fails('com! -complete=custom,CustomComplete docmd :', 'E183:')
call assert_fails('com! -complete=custom,CustomComplete -xxx DoCmd :', 'E181:')
endfunc endfunc
func CustomComplete(A, L, P) func CustomComplete(A, L, P)

View File

@@ -943,7 +943,7 @@ void ex_command(exarg_T *eap)
end = skiptowhite(p); end = skiptowhite(p);
if (uc_scan_attr(p, (size_t)(end - p), &argt, &def, &flags, &compl, (char_u **)&compl_arg, if (uc_scan_attr(p, (size_t)(end - p), &argt, &def, &flags, &compl, (char_u **)&compl_arg,
&addr_type_arg) == FAIL) { &addr_type_arg) == FAIL) {
return; goto theend;
} }
p = skipwhite(end); p = skipwhite(end);
} }
@@ -953,7 +953,7 @@ void ex_command(exarg_T *eap)
end = uc_validate_name(name); end = uc_validate_name(name);
if (!end) { if (!end) {
emsg(_("E182: Invalid command name")); emsg(_("E182: Invalid command name"));
return; goto theend;
} }
name_len = (size_t)(end - name); name_len = (size_t)(end - name);
@@ -971,7 +971,12 @@ void ex_command(exarg_T *eap)
} else { } else {
uc_add_command(name, name_len, p, argt, def, flags, compl, compl_arg, LUA_NOREF, LUA_NOREF, uc_add_command(name, name_len, p, argt, def, flags, compl, compl_arg, LUA_NOREF, LUA_NOREF,
addr_type_arg, LUA_NOREF, eap->forceit); addr_type_arg, LUA_NOREF, eap->forceit);
return; // success
} }
theend:
xfree(compl_arg);
} }
/// ":comclear" /// ":comclear"