aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-05-24 11:43:51 +0200
committerGitHub <noreply@github.com>2019-05-24 11:43:51 +0200
commitd51f132cb150a5adeac9e40ec7409040f32d880e (patch)
treeb9f177db85f96cb79a89706b0448b7add23d1e66 /src/nvim/buffer.c
parent66d127957ed3cc27af0344c742bc5acedd347894 (diff)
parentf1464d0d8023d409906c1a0d2c59e88623bef2e5 (diff)
downloadrneovim-d51f132cb150a5adeac9e40ec7409040f32d880e.tar.gz
rneovim-d51f132cb150a5adeac9e40ec7409040f32d880e.tar.bz2
rneovim-d51f132cb150a5adeac9e40ec7409040f32d880e.zip
Merge #10054 from janlazo/vim-8.1.1373
vim-patch:8.0.{1208,1220},8.1.{1171,1373}
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r--src/nvim/buffer.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index d944c654b0..8a3d4ad418 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -3480,15 +3480,26 @@ 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;
+ // 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 = groupitems[groupdepth] - 1; n >= 0; n--) {
+ if (items[n].type == Highlight) {
+ group_start_userhl = group_end_userhl = items[n].minwid;
break;
}
}
-
- 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;
}