From: Bram Moolenaar Date: Sun, 18 Mar 2018 18:20:22 +0000 (+0100) Subject: patch 8.0.1615: term_dumpload() does not use the right colors X-Git-Tag: v8.0.1615 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=52acb110ac025b57dad5f5ec6004abbe4726a718;p=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(). --- diff --git a/src/terminal.c b/src/terminal.c index 60d0098c5..4d747406e 100644 --- a/src/terminal.c +++ b/src/terminal.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 */ diff --git a/src/version.c b/src/version.c index 5d52bc98a..6beb36e41 100644 --- a/src/version.c +++ b/src/version.c @@ -766,6 +766,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1615, /**/ 1614, /**/