From 5dc5db1557dd438f205698a31b85a83708e3b48f Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 6 Jul 2019 08:37:25 -0400 Subject: vim-patch:8.0.0755: terminal window does not have colors in the GUI Problem: Terminal window does not have colors in the GUI. Solution: Lookup the GUI color. https://github.com/vim/vim/commit/26af85d97ba1ed0ade6cdd41890ca04ed879b9c7 --- src/nvim/syntax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/syntax.c') diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 354590b9ec..ea6dc435df 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -6829,7 +6829,7 @@ void do_highlight(const char *line, const bool forceit, const bool init) } xfree(HL_TABLE()[idx].sg_rgb_fg_name); - if (strcmp(arg, "NONE")) { + if (strcmp(arg, "NONE") != 0) { 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 { -- cgit From 6012e4a52c298bf2ced3dbadd8e43dc0f1db79ad Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 6 Jul 2019 09:05:59 -0400 Subject: vim-patch:8.0.1146: redraw when highlight is set with same names Problem: Redraw when highlight is set with same names. (Ozaki Kiichi) Solution: Only free and save a name when it changed. (closes vim/vim#2120) https://github.com/vim/vim/commit/452030e530aad9b08fcfa71737d098b33c752b85 --- src/nvim/syntax.c | 54 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 21 deletions(-) (limited to 'src/nvim/syntax.c') diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index ea6dc435df..e3aa898bea 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -6823,18 +6823,22 @@ 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") != 0) { - 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; + } } } @@ -6842,18 +6846,22 @@ 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; + } } } @@ -6861,18 +6869,22 @@ 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; + } } } -- cgit From 8c8961d9a28ad9c79dc8de09801d975b8a450257 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 28 Jun 2019 20:50:04 -0400 Subject: 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 --- src/nvim/syntax.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/nvim/syntax.c') 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; } } -- cgit