aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/syntax.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-06-28 20:50:04 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-07-06 09:34:00 -0400
commit8c8961d9a28ad9c79dc8de09801d975b8a450257 (patch)
tree68ff37f6add89cf7dfc968c37d466c2993f94293 /src/nvim/syntax.c
parent6012e4a52c298bf2ced3dbadd8e43dc0f1db79ad (diff)
downloadrneovim-8c8961d9a28ad9c79dc8de09801d975b8a450257.tar.gz
rneovim-8c8961d9a28ad9c79dc8de09801d975b8a450257.tar.bz2
rneovim-8c8961d9a28ad9c79dc8de09801d975b8a450257.zip
vim-patch:8.0.1164: changing StatusLine highlight does not always work
Problem: Changing StatusLine highlight while evaluating 'statusline' may not change the status line color. Solution: When changing highlighting while redrawing don't cause another redraw. (suggested by Ozaki Kiichi, closes vim/vim#2171, closes vim/vim#2120) https://github.com/vim/vim/commit/65ed136844fbaffdd473903ed841c944600234dc
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r--src/nvim/syntax.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index e3aa898bea..0d204b2f43 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -6467,6 +6467,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
int id;
int idx;
struct hl_group item_before;
+ bool did_change = false;
bool dodefault = false;
bool doclear = false;
bool dolink = false;
@@ -6839,6 +6840,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
*namep = NULL;
HL_TABLE()[idx].sg_rgb_fg = -1;
}
+ did_change = true;
}
}
@@ -6862,6 +6864,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
*namep = NULL;
HL_TABLE()[idx].sg_rgb_bg = -1;
}
+ did_change = true;
}
}
@@ -6885,6 +6888,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
*namep = NULL;
HL_TABLE()[idx].sg_rgb_sp = -1;
}
+ did_change = true;
}
}
@@ -6946,9 +6950,15 @@ void do_highlight(const char *line, const bool forceit, const bool init)
// Only call highlight_changed() once, after a sequence of highlight
// commands, and only if an attribute actually changed
- if (memcmp(&HL_TABLE()[idx], &item_before, sizeof(item_before)) != 0
+ if ((did_change
+ || memcmp(&HL_TABLE()[idx], &item_before, sizeof(item_before)) != 0)
&& !did_highlight_changed) {
- redraw_all_later(NOT_VALID);
+ // Do not trigger a redraw when highlighting is changed while
+ // redrawing. This may happen when evaluating 'statusline' changes the
+ // StatusLine group.
+ if (!updating_screen) {
+ redraw_all_later(NOT_VALID);
+ }
need_highlight_changed = true;
}
}