aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-07-19 00:39:50 +0200
committerGitHub <noreply@github.com>2019-07-19 00:39:50 +0200
commit281d422e71903c8b9e1f2c8bfe5972e3c3b1be1b (patch)
tree7c486adcd9c767e9d401b159c796df869f30c91e /src
parent572ecdfeed16c733ca35601ef2339ab38c530d73 (diff)
parent8c8961d9a28ad9c79dc8de09801d975b8a450257 (diff)
downloadrneovim-281d422e71903c8b9e1f2c8bfe5972e3c3b1be1b.tar.gz
rneovim-281d422e71903c8b9e1f2c8bfe5972e3c3b1be1b.tar.bz2
rneovim-281d422e71903c8b9e1f2c8bfe5972e3c3b1be1b.zip
Merge #10368 from janlazo/vim-8.0.1164
vim-patch:8.0.{755,1146,1164}
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer.c13
-rw-r--r--src/nvim/syntax.c68
2 files changed, 51 insertions, 30 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index cd31adbaff..34fe52c10e 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -3366,7 +3366,6 @@ int build_stl_str_hl(
char_u *usefmt = fmt;
const int save_must_redraw = must_redraw;
const int save_redr_type = curwin->w_redr_type;
- const int save_highlight_shcnaged = need_highlight_changed;
// When the format starts with "%!" then evaluate it as an expression and
// use the result as the actual format string.
@@ -4430,12 +4429,12 @@ int build_stl_str_hl(
cur_tab_rec->def.func = NULL;
}
- // We do not want redrawing a stausline, ruler, title, etc. to trigger
- // another redraw, it may cause an endless loop. This happens when a
- // statusline changes a highlight group.
- must_redraw = save_must_redraw;
- curwin->w_redr_type = save_redr_type;
- need_highlight_changed = save_highlight_shcnaged;
+ // When inside update_screen we do not want redrawing a stausline, ruler,
+ // title, etc. to trigger another redraw, it may cause an endless loop.
+ if (updating_screen) {
+ must_redraw = save_must_redraw;
+ curwin->w_redr_type = save_redr_type;
+ }
return width;
}
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 84392680c5..4fa70c0684 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -6474,6 +6474,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;
@@ -6830,18 +6831,23 @@ void do_highlight(const char *line, const bool forceit, const bool init)
}
}
} else if (strcmp(key, "GUIFG") == 0) {
+ char_u **const namep = &HL_TABLE()[idx].sg_rgb_fg_name;
+
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) {
if (!init) {
HL_TABLE()[idx].sg_set |= SG_GUI;
}
- xfree(HL_TABLE()[idx].sg_rgb_fg_name);
- if (strcmp(arg, "NONE")) {
- HL_TABLE()[idx].sg_rgb_fg_name = (char_u *)xstrdup((char *)arg);
- HL_TABLE()[idx].sg_rgb_fg = name_to_color((const char_u *)arg);
- } else {
- HL_TABLE()[idx].sg_rgb_fg_name = NULL;
- HL_TABLE()[idx].sg_rgb_fg = -1;
+ if (*namep == NULL || STRCMP(*namep, arg) != 0) {
+ xfree(*namep);
+ if (strcmp(arg, "NONE") != 0) {
+ *namep = (char_u *)xstrdup(arg);
+ HL_TABLE()[idx].sg_rgb_fg = name_to_color((char_u *)arg);
+ } else {
+ *namep = NULL;
+ HL_TABLE()[idx].sg_rgb_fg = -1;
+ }
+ did_change = true;
}
}
@@ -6849,18 +6855,23 @@ void do_highlight(const char *line, const bool forceit, const bool init)
normal_fg = HL_TABLE()[idx].sg_rgb_fg;
}
} else if (STRCMP(key, "GUIBG") == 0) {
+ char_u **const namep = &HL_TABLE()[idx].sg_rgb_bg_name;
+
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) {
if (!init) {
HL_TABLE()[idx].sg_set |= SG_GUI;
}
- xfree(HL_TABLE()[idx].sg_rgb_bg_name);
- if (STRCMP(arg, "NONE") != 0) {
- HL_TABLE()[idx].sg_rgb_bg_name = (char_u *)xstrdup((char *)arg);
- HL_TABLE()[idx].sg_rgb_bg = name_to_color((const char_u *)arg);
- } else {
- HL_TABLE()[idx].sg_rgb_bg_name = NULL;
- HL_TABLE()[idx].sg_rgb_bg = -1;
+ if (*namep == NULL || STRCMP(*namep, arg) != 0) {
+ xfree(*namep);
+ if (STRCMP(arg, "NONE") != 0) {
+ *namep = (char_u *)xstrdup(arg);
+ HL_TABLE()[idx].sg_rgb_bg = name_to_color((char_u *)arg);
+ } else {
+ *namep = NULL;
+ HL_TABLE()[idx].sg_rgb_bg = -1;
+ }
+ did_change = true;
}
}
@@ -6868,18 +6879,23 @@ void do_highlight(const char *line, const bool forceit, const bool init)
normal_bg = HL_TABLE()[idx].sg_rgb_bg;
}
} else if (strcmp(key, "GUISP") == 0) {
+ char_u **const namep = &HL_TABLE()[idx].sg_rgb_sp_name;
+
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) {
if (!init) {
HL_TABLE()[idx].sg_set |= SG_GUI;
}
- xfree(HL_TABLE()[idx].sg_rgb_sp_name);
- if (strcmp(arg, "NONE") != 0) {
- HL_TABLE()[idx].sg_rgb_sp_name = (char_u *)xstrdup((char *)arg);
- HL_TABLE()[idx].sg_rgb_sp = name_to_color((const char_u *)arg);
- } else {
- HL_TABLE()[idx].sg_rgb_sp_name = NULL;
- HL_TABLE()[idx].sg_rgb_sp = -1;
+ if (*namep == NULL || STRCMP(*namep, arg) != 0) {
+ xfree(*namep);
+ if (strcmp(arg, "NONE") != 0) {
+ *namep = (char_u *)xstrdup(arg);
+ HL_TABLE()[idx].sg_rgb_sp = name_to_color((char_u *)arg);
+ } else {
+ *namep = NULL;
+ HL_TABLE()[idx].sg_rgb_sp = -1;
+ }
+ did_change = true;
}
}
@@ -6941,9 +6957,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;
}
}