comparison src/buffer.c @ 12660:ac6e56d8950e v8.0.1208

patch 8.0.1208: 'statusline' drops empty group with highlight change commit https://github.com/vim/vim/commit/6b89dbb55f84c485310c8c9e094dbafe3ecbace6 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 22 14:22:16 2017 +0200 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 #2228)
author Christian Brabandt <cb@256bit.org>
date Sun, 22 Oct 2017 14:30:06 +0200
parents 560adb3eed8b
children e769c912fcd9
comparison
equal deleted inserted replaced
12659:561e4166fbf1 12660:ac6e56d8950e
3881 char_u *str; 3881 char_u *str;
3882 long num; 3882 long num;
3883 int width; 3883 int width;
3884 int itemcnt; 3884 int itemcnt;
3885 int curitem; 3885 int curitem;
3886 int group_end_userhl;
3887 int group_start_userhl;
3886 int groupitem[STL_MAX_ITEM]; 3888 int groupitem[STL_MAX_ITEM];
3887 int groupdepth; 3889 int groupdepth;
3888 struct stl_item 3890 struct stl_item
3889 { 3891 {
3890 char_u *start; 3892 char_u *start;
4021 *p = NUL; 4023 *p = NUL;
4022 l = vim_strsize(t); 4024 l = vim_strsize(t);
4023 if (curitem > groupitem[groupdepth] + 1 4025 if (curitem > groupitem[groupdepth] + 1
4024 && item[groupitem[groupdepth]].minwid == 0) 4026 && item[groupitem[groupdepth]].minwid == 0)
4025 { 4027 {
4026 /* remove group if all items are empty */ 4028 /* remove group if all items are empty and highlight group
4029 * doesn't change */
4030 group_start_userhl = group_end_userhl = 0;
4031 for (n = 0; n < groupitem[groupdepth]; n++)
4032 if (item[n].type == Highlight)
4033 group_start_userhl = item[n].minwid;
4027 for (n = groupitem[groupdepth] + 1; n < curitem; n++) 4034 for (n = groupitem[groupdepth] + 1; n < curitem; n++)
4028 if (item[n].type == Normal || item[n].type == Highlight) 4035 {
4036 if (item[n].type == Normal)
4029 break; 4037 break;
4030 if (n == curitem) 4038 if (item[n].type == Highlight)
4039 group_end_userhl = item[n].minwid;
4040 }
4041 if (n == curitem && group_start_userhl == group_end_userhl)
4031 { 4042 {
4032 p = t; 4043 p = t;
4033 l = 0; 4044 l = 0;
4034 } 4045 }
4035 } 4046 }