1
0
forked from aniani/vim

patch 8.0.1615: term_dumpload() does not use the right colors

Problem:    term_dumpload() does not use the right colors.
Solution:   Initialize colors when not using create_vterm().
This commit is contained in:
Bram Moolenaar
2018-03-18 19:20:22 +01:00
parent 98ef233e14
commit 52acb110ac
2 changed files with 30 additions and 13 deletions

View File

@@ -3011,25 +3011,15 @@ cterm_color2rgb(int nr, VTermColor *rgb)
} }
/* /*
* Create a new vterm and initialize it. * Initialize term->tl_default_color from the environment.
*/ */
static void static void
create_vterm(term_T *term, int rows, int cols) init_default_colors(term_T *term)
{ {
VTerm *vterm;
VTermScreen *screen;
VTermValue value;
VTermColor *fg, *bg; VTermColor *fg, *bg;
int fgval, bgval; int fgval, bgval;
int id; int id;
vterm = vterm_new(rows, cols);
term->tl_vterm = vterm;
screen = vterm_obtain_screen(vterm);
vterm_screen_set_callbacks(screen, &screen_callbacks, term);
/* TODO: depends on 'encoding'. */
vterm_set_utf8(vterm, 1);
vim_memset(&term->tl_default_color.attrs, 0, sizeof(VTermScreenCellAttrs)); vim_memset(&term->tl_default_color.attrs, 0, sizeof(VTermScreenCellAttrs));
term->tl_default_color.width = 1; term->tl_default_color.width = 1;
fg = &term->tl_default_color.fg; fg = &term->tl_default_color.fg;
@@ -3152,8 +3142,31 @@ create_vterm(term_T *term, int rows, int cols)
term_get_bg_color(&bg->red, &bg->green, &bg->blue); term_get_bg_color(&bg->red, &bg->green, &bg->blue);
# endif # endif
} }
}
vterm_state_set_default_colors(vterm_obtain_state(vterm), fg, bg); /*
* Create a new vterm and initialize it.
*/
static void
create_vterm(term_T *term, int rows, int cols)
{
VTerm *vterm;
VTermScreen *screen;
VTermValue value;
vterm = vterm_new(rows, cols);
term->tl_vterm = vterm;
screen = vterm_obtain_screen(vterm);
vterm_screen_set_callbacks(screen, &screen_callbacks, term);
/* TODO: depends on 'encoding'. */
vterm_set_utf8(vterm, 1);
init_default_colors(term);
vterm_state_set_default_colors(
vterm_obtain_state(vterm),
&term->tl_default_color.fg,
&term->tl_default_color.bg);
/* Required to initialize most things. */ /* Required to initialize most things. */
vterm_screen_reset(screen, 1 /* hard */); vterm_screen_reset(screen, 1 /* hard */);
@@ -3767,6 +3780,8 @@ term_load_dump(typval_T *argvars, typval_T *rettv, int do_diff)
VTermPos cursor_pos1; VTermPos cursor_pos1;
VTermPos cursor_pos2; VTermPos cursor_pos2;
init_default_colors(term);
rettv->vval.v_number = buf->b_fnum; rettv->vval.v_number = buf->b_fnum;
/* read the files, fill the buffer with the diff */ /* read the files, fill the buffer with the diff */

View File

@@ -766,6 +766,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 */
/**/
1615,
/**/ /**/
1614, 1614,
/**/ /**/