refactor: only reload colorscheme if &bg changed (#26598)

Currently, setting &bg at all re-initializes highlights and reloads
the active colorscheme, even if the actual value of &bg has not changed.
With https://github.com/neovim/neovim/pull/26595 this causes a
regression since &bg is set unconditionally based on the value detected
from the terminal.

Instead, only reload the colorscheme if the actual value of &bg has
changed.
This commit is contained in:
Gregory Anders
2023-12-16 11:18:45 -06:00
committed by GitHub
parent 7840760776
commit 8fb7419d7c
5 changed files with 14 additions and 19 deletions

View File

@@ -663,12 +663,17 @@ int expand_set_ambiwidth(optexpand_T *args, int *numMatches, char ***matches)
}
/// The 'background' option is changed.
const char *did_set_background(optset_T *args FUNC_ATTR_UNUSED)
const char *did_set_background(optset_T *args)
{
if (check_opt_strings(p_bg, p_bg_values, false) != OK) {
return e_invarg;
}
if (args->os_oldval.string.data[0] == *p_bg) {
// Value was not changed
return NULL;
}
int dark = (*p_bg == 'd');
init_highlight(false, false);