To: vim_dev@googlegroups.com Subject: Patch 8.0.1543 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1543 Problem: With 'termguicolors' Normal color doesn't work correctly. Solution: Set cterm_normal_bg_gui_color and cterm_normal_fg_color always. (Kazunobu Kuriyama, closes #981, closes #2332) Files: src/syntax.c *** ../vim-8.0.1542/src/syntax.c 2018-02-24 21:36:30.538119108 +0100 --- src/syntax.c 2018-02-27 12:49:13.114252486 +0100 *************** *** 8411,8420 **** void set_normal_colors(void) { ! #ifdef FEAT_GUI ! # ifdef FEAT_TERMGUICOLORS if (gui.in_use) ! # endif { if (set_group_colors((char_u *)"Normal", &gui.norm_pixel, &gui.back_pixel, --- 8411,8420 ---- void set_normal_colors(void) { ! # ifdef FEAT_GUI ! # ifdef FEAT_TERMGUICOLORS if (gui.in_use) ! # endif { if (set_group_colors((char_u *)"Normal", &gui.norm_pixel, &gui.back_pixel, *************** *** 8423,8449 **** gui_mch_new_colors(); must_redraw = CLEAR; } ! # ifdef FEAT_GUI_X11 if (set_group_colors((char_u *)"Menu", &gui.menu_fg_pixel, &gui.menu_bg_pixel, TRUE, FALSE, FALSE)) { ! # ifdef FEAT_MENU gui_mch_new_menu_colors(); ! # endif must_redraw = CLEAR; } ! # ifdef FEAT_BEVAL_GUI if (set_group_colors((char_u *)"Tooltip", &gui.tooltip_fg_pixel, &gui.tooltip_bg_pixel, FALSE, FALSE, TRUE)) { ! # ifdef FEAT_TOOLBAR gui_mch_new_tooltip_colors(); ! # endif must_redraw = CLEAR; } ! # endif if (set_group_colors((char_u *)"Scrollbar", &gui.scroll_fg_pixel, &gui.scroll_bg_pixel, FALSE, FALSE, FALSE)) --- 8423,8449 ---- gui_mch_new_colors(); must_redraw = CLEAR; } ! # ifdef FEAT_GUI_X11 if (set_group_colors((char_u *)"Menu", &gui.menu_fg_pixel, &gui.menu_bg_pixel, TRUE, FALSE, FALSE)) { ! # ifdef FEAT_MENU gui_mch_new_menu_colors(); ! # endif must_redraw = CLEAR; } ! # ifdef FEAT_BEVAL_GUI if (set_group_colors((char_u *)"Tooltip", &gui.tooltip_fg_pixel, &gui.tooltip_bg_pixel, FALSE, FALSE, TRUE)) { ! # ifdef FEAT_TOOLBAR gui_mch_new_tooltip_colors(); ! # endif must_redraw = CLEAR; } ! # endif if (set_group_colors((char_u *)"Scrollbar", &gui.scroll_fg_pixel, &gui.scroll_bg_pixel, FALSE, FALSE, FALSE)) *************** *** 8451,8463 **** gui_new_scrollbar_colors(); must_redraw = CLEAR; } ! # endif } - #endif - #ifdef FEAT_TERMGUICOLORS - # ifdef FEAT_GUI - else # endif { int idx; --- 8451,8463 ---- gui_new_scrollbar_colors(); must_redraw = CLEAR; } ! # endif } # endif + # ifdef FEAT_TERMGUICOLORS + # ifdef FEAT_GUI + else + # endif { int idx; *************** *** 8466,8484 **** { gui_do_one_color(idx, FALSE, FALSE); ! if (HL_TABLE()[idx].sg_gui_fg != INVALCOLOR) { cterm_normal_fg_gui_color = HL_TABLE()[idx].sg_gui_fg; - must_redraw = CLEAR; - } - if (HL_TABLE()[idx].sg_gui_bg != INVALCOLOR) - { cterm_normal_bg_gui_color = HL_TABLE()[idx].sg_gui_bg; must_redraw = CLEAR; } } } ! #endif } #endif --- 8466,8485 ---- { gui_do_one_color(idx, FALSE, FALSE); ! /* If the normal fg or bg color changed a complete redraw is ! * required. */ ! if (cterm_normal_fg_gui_color != HL_TABLE()[idx].sg_gui_fg ! || cterm_normal_bg_gui_color != HL_TABLE()[idx].sg_gui_bg) { + /* if the GUI color is INVALCOLOR then we use the default cterm + * color */ cterm_normal_fg_gui_color = HL_TABLE()[idx].sg_gui_fg; cterm_normal_bg_gui_color = HL_TABLE()[idx].sg_gui_bg; must_redraw = CLEAR; } } } ! # endif } #endif *************** *** 9867,9875 **** return hl_id; } ! #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) /* * Call this function just after the GUI has started. * It finds the font and color handles for the highlighting groups. */ void --- 9868,9877 ---- return hl_id; } ! #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) /* * Call this function just after the GUI has started. + * Also called when 'termguicolors' was set, gui.in_use will be FALSE then. * It finds the font and color handles for the highlighting groups. */ void *************** *** 9878,9889 **** int idx; /* First get the colors from the "Normal" and "Menu" group, if set */ - # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) - # ifdef FEAT_TERMGUICOLORS if (USE_24BIT) - # endif set_normal_colors(); - # endif for (idx = 0; idx < highlight_ga.ga_len; ++idx) gui_do_one_color(idx, FALSE, FALSE); --- 9880,9887 ---- *** ../vim-8.0.1542/src/version.c 2018-02-25 21:39:41.693475616 +0100 --- src/version.c 2018-02-27 12:51:22.101427014 +0100 *************** *** 780,781 **** --- 780,783 ---- { /* Add new patch number below this line */ + /**/ + 1543, /**/ -- Living on Earth includes an annual free trip around the Sun. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///