diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-10-22 14:22:16 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-10-22 14:22:16 +0200 |
commit | 6b89dbb55f84c485310c8c9e094dbafe3ecbace6 (patch) | |
tree | 71fac531f52e81ecc490c8d484df97cd69c08ca3 /src/buffer.c | |
parent | 67435d9983965c5c77fc74f0559779ce4554dacb (diff) | |
download | vim-git-6b89dbb55f84c485310c8c9e094dbafe3ecbace6.tar.gz |
patch 8.0.1208: 'statusline' drops empty group with highlight changev8.0.1208
Problem: 'statusline' drops empty group with highlight change.
Solution: Do not drop an empty group if it changes highlighting. (Marius
Gedminas, closes #2228)
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/buffer.c b/src/buffer.c index 22effbb81..1bf692a83 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -3883,6 +3883,8 @@ build_stl_str_hl( int width; int itemcnt; int curitem; + int group_end_userhl; + int group_start_userhl; int groupitem[STL_MAX_ITEM]; int groupdepth; struct stl_item @@ -4023,11 +4025,20 @@ build_stl_str_hl( if (curitem > groupitem[groupdepth] + 1 && item[groupitem[groupdepth]].minwid == 0) { - /* remove group if all items are empty */ + /* remove group if all items are empty and highlight group + * doesn't change */ + group_start_userhl = group_end_userhl = 0; + for (n = 0; n < groupitem[groupdepth]; n++) + if (item[n].type == Highlight) + group_start_userhl = item[n].minwid; for (n = groupitem[groupdepth] + 1; n < curitem; n++) - if (item[n].type == Normal || item[n].type == Highlight) + { + if (item[n].type == Normal) break; - if (n == curitem) + if (item[n].type == Highlight) + group_end_userhl = item[n].minwid; + } + if (n == curitem && group_start_userhl == group_end_userhl) { p = t; l = 0; |