mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 22:38:16 +00:00
vim-patch:8.0.1208: 'statusline' drops empty group with highlight change
Problem: 'statusline' drops empty group with highlight change.
Solution: Do not drop an empty group if it changes highlighting. (Marius
Gedminas, closes vim/vim#2228)
6b89dbb55f
This commit is contained in:
@@ -3480,15 +3480,25 @@ int build_stl_str_hl(
|
||||
// Otherwise there would be no reason to do this step.
|
||||
if (curitem > groupitems[groupdepth] + 1
|
||||
&& items[groupitems[groupdepth]].minwid == 0) {
|
||||
bool has_normal_items = false;
|
||||
for (long n = groupitems[groupdepth] + 1; n < curitem; n++) {
|
||||
if (items[n].type == Normal || items[n].type == Highlight) {
|
||||
has_normal_items = true;
|
||||
break;
|
||||
// remove group if all items are empty and highlight group
|
||||
// doesn't change
|
||||
int group_start_userhl = 0;
|
||||
int group_end_userhl = 0;
|
||||
int n;
|
||||
for (n = 0; n < groupitems[groupdepth]; n++) {
|
||||
if (items[n].type == Highlight) {
|
||||
group_start_userhl = items[n].minwid;
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_normal_items) {
|
||||
for (n = groupitems[groupdepth] + 1; n < curitem; n++) {
|
||||
if (items[n].type == Normal) {
|
||||
break;
|
||||
}
|
||||
if (items[n].type == Highlight) {
|
||||
group_end_userhl = items[n].minwid;
|
||||
}
|
||||
}
|
||||
if (n == curitem && group_start_userhl == group_end_userhl) {
|
||||
out_p = t;
|
||||
group_len = 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user