mirror of
https://github.com/neovim/neovim.git
synced 2025-11-25 03:30:37 +00:00
vim-patch:8.0.0616: not always setting 'background' correctly after :hi Normal (#8606)
Problem: When setting the cterm background with ":hi Normal" the value of
'background' may be set wrongly.
Solution: Check that the color is less than 16. Don't set 'background' when
it was set explicitly. (Lemonboy, closes vim/vim#1710)
1615b36b91
Restore reset_option_was_set(), removed in 419da839e0
ref #8595
ref #8597
This commit is contained in:
committed by
Justin M. Keyes
parent
8794a551bd
commit
52ebe34eeb
@@ -6812,15 +6812,21 @@ void do_highlight(const char *line, const bool forceit, const bool init)
|
||||
if (!ui_rgb_attached()) {
|
||||
must_redraw = CLEAR;
|
||||
if (color >= 0) {
|
||||
int dark = -1;
|
||||
|
||||
if (t_colors < 16) {
|
||||
i = (color == 0 || color == 4);
|
||||
} else {
|
||||
i = (color < 7 || color == 8);
|
||||
dark = (color == 0 || color == 4);
|
||||
} else if (color < 16) {
|
||||
// Limit the heuristic to the standard 16 colors
|
||||
dark = (color < 7 || color == 8);
|
||||
}
|
||||
// Set the 'background' option if the value is
|
||||
// wrong.
|
||||
if (i != (*p_bg == 'd')) {
|
||||
set_option_value("bg", 0L, (i ? "dark" : "light"), 0);
|
||||
if (dark != -1
|
||||
&& dark != (*p_bg == 'd')
|
||||
&& !option_was_set("bg")) {
|
||||
set_option_value("bg", 0L, (dark ? "dark" : "light"), 0);
|
||||
reset_option_was_set("bg");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user