]> granicus.if.org Git - vim/commitdiff
patch 8.0.1615: term_dumpload() does not use the right colors v8.0.1615
authorBram Moolenaar <Bram@vim.org>
Sun, 18 Mar 2018 18:20:22 +0000 (19:20 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 18 Mar 2018 18:20:22 +0000 (19:20 +0100)
Problem:    term_dumpload() does not use the right colors.
Solution:   Initialize colors when not using create_vterm().

src/terminal.c
src/version.c

index 60d0098c504cebca6e72c9864997dcd9dee06cee..4d747406e5b53f23979d8f150beab120057e296b 100644 (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
-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 */
index 5d52bc98a31add1aaa4921eb785820c0bf2bda0e..6beb36e4145ccc76981ff640d5d9a37c609aa846 100644 (file)
@@ -766,6 +766,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1615,
 /**/
     1614,
 /**/