Skip to content
Permalink
Browse files
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().
  • Loading branch information
brammool committed Mar 18, 2018
1 parent 98ef233 commit 52acb110ac025b57dad5f5ec6004abbe4726a718
Showing with 30 additions and 13 deletions.
  1. +28 −13 src/terminal.c
  2. +2 −0 src/version.c
@@ -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
create_vterm(term_T *term, int rows, int cols)
init_default_colors(term_T *term)
{
VTerm *vterm;
VTermScreen *screen;
VTermValue value;
VTermColor *fg, *bg;
int fgval, bgval;
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));
term->tl_default_color.width = 1;
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);
# endif
}
}

/*
* 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);

vterm_state_set_default_colors(vterm_obtain_state(vterm), fg, bg);
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. */
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_pos2;

init_default_colors(term);

rettv->vval.v_number = buf->b_fnum;

/* read the files, fill the buffer with the diff */
@@ -766,6 +766,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1615,
/**/
1614,
/**/

0 comments on commit 52acb11

Please sign in to comment.