changeset 13483:f7ef5d579758 v8.0.1615

patch 8.0.1615: term_dumpload() does not use the right colors commit https://github.com/vim/vim/commit/52acb110ac025b57dad5f5ec6004abbe4726a718 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 18 19:20:22 2018 +0100 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().
author Christian Brabandt <cb@256bit.org>
date Sun, 18 Mar 2018 19:30:06 +0100
parents 9eebe457eb3c
children d78a9f72543c
files src/terminal.c src/version.c
diffstat 2 files changed, 31 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- 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
 	    term_get_bg_color(&bg->red, &bg->green, &bg->blue);
 # 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. */
     vterm_screen_reset(screen, 1 /* hard */);
@@ -3767,6 +3780,8 @@ term_load_dump(typval_T *argvars, typval
 	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 */
--- a/src/version.c
+++ b/src/version.c
@@ -767,6 +767,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1615,
+/**/
     1614,
 /**/
     1613,