Mercurial > vim
comparison src/syntax.c @ 13337:1b7522243dde v8.0.1543
patch 8.0.1543: with 'termguicolors' Normal color doesn't work correctly
commit https://github.com/vim/vim/commit/33ef5bb0e4ea9a049c4311cfe59d1926dcb963a4
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 27 13:04:59 2018 +0100
patch 8.0.1543: with 'termguicolors' Normal color doesn't work correctly
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)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 27 Feb 2018 13:15:07 +0100 |
parents | b4e7082de11d |
children | da2a9e217200 |
comparison
equal
deleted
inserted
replaced
13336:808b05be72d1 | 13337:1b7522243dde |
---|---|
8409 * "Tooltip" colors. | 8409 * "Tooltip" colors. |
8410 */ | 8410 */ |
8411 void | 8411 void |
8412 set_normal_colors(void) | 8412 set_normal_colors(void) |
8413 { | 8413 { |
8414 #ifdef FEAT_GUI | 8414 # ifdef FEAT_GUI |
8415 # ifdef FEAT_TERMGUICOLORS | 8415 # ifdef FEAT_TERMGUICOLORS |
8416 if (gui.in_use) | 8416 if (gui.in_use) |
8417 # endif | 8417 # endif |
8418 { | 8418 { |
8419 if (set_group_colors((char_u *)"Normal", | 8419 if (set_group_colors((char_u *)"Normal", |
8420 &gui.norm_pixel, &gui.back_pixel, | 8420 &gui.norm_pixel, &gui.back_pixel, |
8421 FALSE, TRUE, FALSE)) | 8421 FALSE, TRUE, FALSE)) |
8422 { | 8422 { |
8423 gui_mch_new_colors(); | 8423 gui_mch_new_colors(); |
8424 must_redraw = CLEAR; | 8424 must_redraw = CLEAR; |
8425 } | 8425 } |
8426 # ifdef FEAT_GUI_X11 | 8426 # ifdef FEAT_GUI_X11 |
8427 if (set_group_colors((char_u *)"Menu", | 8427 if (set_group_colors((char_u *)"Menu", |
8428 &gui.menu_fg_pixel, &gui.menu_bg_pixel, | 8428 &gui.menu_fg_pixel, &gui.menu_bg_pixel, |
8429 TRUE, FALSE, FALSE)) | 8429 TRUE, FALSE, FALSE)) |
8430 { | 8430 { |
8431 # ifdef FEAT_MENU | 8431 # ifdef FEAT_MENU |
8432 gui_mch_new_menu_colors(); | 8432 gui_mch_new_menu_colors(); |
8433 # endif | 8433 # endif |
8434 must_redraw = CLEAR; | 8434 must_redraw = CLEAR; |
8435 } | 8435 } |
8436 # ifdef FEAT_BEVAL_GUI | 8436 # ifdef FEAT_BEVAL_GUI |
8437 if (set_group_colors((char_u *)"Tooltip", | 8437 if (set_group_colors((char_u *)"Tooltip", |
8438 &gui.tooltip_fg_pixel, &gui.tooltip_bg_pixel, | 8438 &gui.tooltip_fg_pixel, &gui.tooltip_bg_pixel, |
8439 FALSE, FALSE, TRUE)) | 8439 FALSE, FALSE, TRUE)) |
8440 { | 8440 { |
8441 # ifdef FEAT_TOOLBAR | 8441 # ifdef FEAT_TOOLBAR |
8442 gui_mch_new_tooltip_colors(); | 8442 gui_mch_new_tooltip_colors(); |
8443 # endif | |
8444 must_redraw = CLEAR; | |
8445 } | |
8443 # endif | 8446 # endif |
8444 must_redraw = CLEAR; | |
8445 } | |
8446 # endif | |
8447 if (set_group_colors((char_u *)"Scrollbar", | 8447 if (set_group_colors((char_u *)"Scrollbar", |
8448 &gui.scroll_fg_pixel, &gui.scroll_bg_pixel, | 8448 &gui.scroll_fg_pixel, &gui.scroll_bg_pixel, |
8449 FALSE, FALSE, FALSE)) | 8449 FALSE, FALSE, FALSE)) |
8450 { | 8450 { |
8451 gui_new_scrollbar_colors(); | 8451 gui_new_scrollbar_colors(); |
8452 must_redraw = CLEAR; | 8452 must_redraw = CLEAR; |
8453 } | 8453 } |
8454 # endif | |
8455 } | |
8454 # endif | 8456 # endif |
8455 } | 8457 # ifdef FEAT_TERMGUICOLORS |
8456 #endif | 8458 # ifdef FEAT_GUI |
8457 #ifdef FEAT_TERMGUICOLORS | |
8458 # ifdef FEAT_GUI | |
8459 else | 8459 else |
8460 # endif | 8460 # endif |
8461 { | 8461 { |
8462 int idx; | 8462 int idx; |
8463 | 8463 |
8464 idx = syn_name2id((char_u *)"Normal") - 1; | 8464 idx = syn_name2id((char_u *)"Normal") - 1; |
8465 if (idx >= 0) | 8465 if (idx >= 0) |
8466 { | 8466 { |
8467 gui_do_one_color(idx, FALSE, FALSE); | 8467 gui_do_one_color(idx, FALSE, FALSE); |
8468 | 8468 |
8469 if (HL_TABLE()[idx].sg_gui_fg != INVALCOLOR) | 8469 /* If the normal fg or bg color changed a complete redraw is |
8470 { | 8470 * required. */ |
8471 if (cterm_normal_fg_gui_color != HL_TABLE()[idx].sg_gui_fg | |
8472 || cterm_normal_bg_gui_color != HL_TABLE()[idx].sg_gui_bg) | |
8473 { | |
8474 /* if the GUI color is INVALCOLOR then we use the default cterm | |
8475 * color */ | |
8471 cterm_normal_fg_gui_color = HL_TABLE()[idx].sg_gui_fg; | 8476 cterm_normal_fg_gui_color = HL_TABLE()[idx].sg_gui_fg; |
8472 must_redraw = CLEAR; | |
8473 } | |
8474 if (HL_TABLE()[idx].sg_gui_bg != INVALCOLOR) | |
8475 { | |
8476 cterm_normal_bg_gui_color = HL_TABLE()[idx].sg_gui_bg; | 8477 cterm_normal_bg_gui_color = HL_TABLE()[idx].sg_gui_bg; |
8477 must_redraw = CLEAR; | 8478 must_redraw = CLEAR; |
8478 } | 8479 } |
8479 } | 8480 } |
8480 } | 8481 } |
8481 #endif | 8482 # endif |
8482 } | 8483 } |
8483 #endif | 8484 #endif |
8484 | 8485 |
8485 #if defined(FEAT_GUI) || defined(PROTO) | 8486 #if defined(FEAT_GUI) || defined(PROTO) |
8486 /* | 8487 /* |
9865 } | 9866 } |
9866 | 9867 |
9867 return hl_id; | 9868 return hl_id; |
9868 } | 9869 } |
9869 | 9870 |
9870 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) | 9871 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) |
9871 /* | 9872 /* |
9872 * Call this function just after the GUI has started. | 9873 * Call this function just after the GUI has started. |
9874 * Also called when 'termguicolors' was set, gui.in_use will be FALSE then. | |
9873 * It finds the font and color handles for the highlighting groups. | 9875 * It finds the font and color handles for the highlighting groups. |
9874 */ | 9876 */ |
9875 void | 9877 void |
9876 highlight_gui_started(void) | 9878 highlight_gui_started(void) |
9877 { | 9879 { |
9878 int idx; | 9880 int idx; |
9879 | 9881 |
9880 /* First get the colors from the "Normal" and "Menu" group, if set */ | 9882 /* First get the colors from the "Normal" and "Menu" group, if set */ |
9881 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) | |
9882 # ifdef FEAT_TERMGUICOLORS | |
9883 if (USE_24BIT) | 9883 if (USE_24BIT) |
9884 # endif | |
9885 set_normal_colors(); | 9884 set_normal_colors(); |
9886 # endif | |
9887 | 9885 |
9888 for (idx = 0; idx < highlight_ga.ga_len; ++idx) | 9886 for (idx = 0; idx < highlight_ga.ga_len; ++idx) |
9889 gui_do_one_color(idx, FALSE, FALSE); | 9887 gui_do_one_color(idx, FALSE, FALSE); |
9890 | 9888 |
9891 highlight_changed(); | 9889 highlight_changed(); |