Merge pull request #12717 from jamessan/release-0.4-backports

This commit is contained in:
James McCoy
2020-08-04 15:28:44 -04:00
committed by GitHub
4 changed files with 39 additions and 3 deletions

View File

@ -3530,13 +3530,19 @@ int build_stl_str_hl(
}
}
if (n == curitem && group_start_userhl == group_end_userhl) {
// empty group
out_p = t;
group_len = 0;
// do not use the highlighting from the removed group
for (n = groupitems[groupdepth] + 1; n < curitem; n++) {
// do not use the highlighting from the removed group
if (items[n].type == Highlight) {
items[n].type = Empty;
}
// adjust the start position of TabPage to the next
// item position
if (items[n].type == TabPage) {
items[n].start = out_p;
}
}
}
}

View File

@ -11,7 +11,7 @@
// The characters and attributes drawn on grids.
typedef char_u schar_T[(MAX_MCO+1) * 4 + 1];
typedef int16_t sattr_T;
typedef int sattr_T;
/// ScreenGrid represents a resizable rectuangular grid displayed by UI clients.
///

View File

@ -90,7 +90,12 @@ static int get_attr_entry(HlEntry entry)
}
}
id = (int)kv_size(attr_entries);
size_t next_id = kv_size(attr_entries);
if (next_id > INT_MAX) {
ELOG("The index on attr_entries has overflowed");
return 0;
}
id = (int)next_id;
kv_push(attr_entries, entry);
map_put(HlEntry, int)(attr_entry_ids, entry, id);

View File

@ -64,3 +64,28 @@ func Test_redrawtabline()
let &showtabline = showtabline_save
au! Bufadd
endfunc
function EmptyTabname()
return ""
endfunction
function MakeTabLine() abort
let titles = map(range(1, tabpagenr('$')), '"%( %" . v:val . "T%{EmptyTabname()}%T %)"')
let sep = 'あ'
let tabpages = join(titles, sep)
return tabpages .. sep .. '%=%999X X'
endfunction
func Test_tabline_empty_group()
" this was reading invalid memory
set tabline=%!MakeTabLine()
tabnew
redraw!
tabclose
set tabline=
endfunc
" vim: shiftwidth=2 sts=2 expandtab