0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.2830: terminal colors are not updated when 'background' is set

Problem:    Terminal colors are not updated when 'background' is set.
Solution:   Call term_update_colors() for all terminals. (Marcin Szamotulski,
            closes #8171, closes #8150)
This commit is contained in:
Bram Moolenaar
2021-05-03 20:40:38 +02:00
parent df36514a64
commit ad43199572
4 changed files with 27 additions and 7 deletions

View File

@@ -907,6 +907,9 @@ ambw_end:
check_string_option(&p_bg); check_string_option(&p_bg);
init_highlight(FALSE, FALSE); init_highlight(FALSE, FALSE);
} }
#endif
#ifdef FEAT_TERMINAL
term_update_colors_all();
#endif #endif
} }
else else
@@ -2176,7 +2179,7 @@ ambw_end:
else if (varp == &curwin->w_p_wcr) else if (varp == &curwin->w_p_wcr)
{ {
if (curwin->w_buffer->b_term != NULL) if (curwin->w_buffer->b_term != NULL)
term_update_colors(); term_update_colors(curwin->w_buffer->b_term);
} }
# if defined(MSWIN) # if defined(MSWIN)
// 'termwintype' // 'termwintype'

View File

@@ -19,6 +19,7 @@ cursorentry_T *term_get_cursor_shape(guicolor_T *fg, guicolor_T *bg);
int term_use_loop(void); int term_use_loop(void);
void term_win_entered(void); void term_win_entered(void);
int terminal_loop(int blocking); int terminal_loop(int blocking);
void set_terminal_default_colors(int cterm_fg, int cterm_bg);
int may_close_term_popup(void); int may_close_term_popup(void);
void term_channel_closed(channel_T *ch); void term_channel_closed(channel_T *ch);
void term_check_channel_closed_recently(void); void term_check_channel_closed_recently(void);
@@ -28,10 +29,10 @@ int term_is_finished(buf_T *buf);
int term_show_buffer(buf_T *buf); int term_show_buffer(buf_T *buf);
void term_change_in_curbuf(void); void term_change_in_curbuf(void);
int term_get_attr(win_T *wp, linenr_T lnum, int col); int term_get_attr(win_T *wp, linenr_T lnum, int col);
void term_update_colors(void); void term_update_colors(term_T *term);
void term_update_colors_all(void);
char_u *term_get_status_text(term_T *term); char_u *term_get_status_text(term_T *term);
int set_ref_in_term(int copyID); int set_ref_in_term(int copyID);
void set_terminal_default_colors(int cterm_fg, int cterm_bg);
void f_term_dumpwrite(typval_T *argvars, typval_T *rettv); void f_term_dumpwrite(typval_T *argvars, typval_T *rettv);
int term_swap_diff(void); int term_swap_diff(void);
void f_term_dumpdiff(typval_T *argvars, typval_T *rettv); void f_term_dumpdiff(typval_T *argvars, typval_T *rettv);

View File

@@ -4590,9 +4590,9 @@ create_vterm(term_T *term, int rows, int cols)
* Called when 'wincolor' was set. * Called when 'wincolor' was set.
*/ */
void void
term_update_colors(void) term_update_colors(term_T *term)
{ {
term_T *term = curwin->w_buffer->b_term; win_T *wp;
if (term->tl_vterm == NULL) if (term->tl_vterm == NULL)
return; return;
@@ -4602,7 +4602,21 @@ term_update_colors(void)
&term->tl_default_color.fg, &term->tl_default_color.fg,
&term->tl_default_color.bg); &term->tl_default_color.bg);
redraw_later(NOT_VALID); FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == term->tl_buffer)
redraw_win_later(wp, NOT_VALID);
}
/*
* Called when 'background' was set.
*/
void
term_update_colors_all(void)
{
term_T *tp;
FOR_ALL_TERMS(tp)
term_update_colors(tp);
} }
/* /*
@@ -5939,7 +5953,7 @@ f_term_list(typval_T *argvars UNUSED, typval_T *rettv)
l = rettv->vval.v_list; l = rettv->vval.v_list;
FOR_ALL_TERMS(tp) FOR_ALL_TERMS(tp)
if (tp != NULL && tp->tl_buffer != NULL) if (tp->tl_buffer != NULL)
if (list_append_number(l, if (list_append_number(l,
(varnumber_T)tp->tl_buffer->b_fnum) == FAIL) (varnumber_T)tp->tl_buffer->b_fnum) == FAIL)
return; return;

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2830,
/**/ /**/
2829, 2829,
/**/ /**/