Mercurial > vim
comparison src/terminal.c @ 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 | d130044d4f1f |
children | a4a559e08798 |
comparison
equal
deleted
inserted
replaced
13482:9eebe457eb3c | 13483:f7ef5d579758 |
---|---|
3009 rgb->ansi_index = VTERM_ANSI_INDEX_NONE; | 3009 rgb->ansi_index = VTERM_ANSI_INDEX_NONE; |
3010 } | 3010 } |
3011 } | 3011 } |
3012 | 3012 |
3013 /* | 3013 /* |
3014 * Create a new vterm and initialize it. | 3014 * Initialize term->tl_default_color from the environment. |
3015 */ | 3015 */ |
3016 static void | 3016 static void |
3017 create_vterm(term_T *term, int rows, int cols) | 3017 init_default_colors(term_T *term) |
3018 { | 3018 { |
3019 VTerm *vterm; | |
3020 VTermScreen *screen; | |
3021 VTermValue value; | |
3022 VTermColor *fg, *bg; | 3019 VTermColor *fg, *bg; |
3023 int fgval, bgval; | 3020 int fgval, bgval; |
3024 int id; | 3021 int id; |
3025 | |
3026 vterm = vterm_new(rows, cols); | |
3027 term->tl_vterm = vterm; | |
3028 screen = vterm_obtain_screen(vterm); | |
3029 vterm_screen_set_callbacks(screen, &screen_callbacks, term); | |
3030 /* TODO: depends on 'encoding'. */ | |
3031 vterm_set_utf8(vterm, 1); | |
3032 | 3022 |
3033 vim_memset(&term->tl_default_color.attrs, 0, sizeof(VTermScreenCellAttrs)); | 3023 vim_memset(&term->tl_default_color.attrs, 0, sizeof(VTermScreenCellAttrs)); |
3034 term->tl_default_color.width = 1; | 3024 term->tl_default_color.width = 1; |
3035 fg = &term->tl_default_color.fg; | 3025 fg = &term->tl_default_color.fg; |
3036 bg = &term->tl_default_color.bg; | 3026 bg = &term->tl_default_color.bg; |
3150 # ifdef FEAT_TERMRESPONSE | 3140 # ifdef FEAT_TERMRESPONSE |
3151 else | 3141 else |
3152 term_get_bg_color(&bg->red, &bg->green, &bg->blue); | 3142 term_get_bg_color(&bg->red, &bg->green, &bg->blue); |
3153 # endif | 3143 # endif |
3154 } | 3144 } |
3155 | 3145 } |
3156 vterm_state_set_default_colors(vterm_obtain_state(vterm), fg, bg); | 3146 |
3147 /* | |
3148 * Create a new vterm and initialize it. | |
3149 */ | |
3150 static void | |
3151 create_vterm(term_T *term, int rows, int cols) | |
3152 { | |
3153 VTerm *vterm; | |
3154 VTermScreen *screen; | |
3155 VTermValue value; | |
3156 | |
3157 vterm = vterm_new(rows, cols); | |
3158 term->tl_vterm = vterm; | |
3159 screen = vterm_obtain_screen(vterm); | |
3160 vterm_screen_set_callbacks(screen, &screen_callbacks, term); | |
3161 /* TODO: depends on 'encoding'. */ | |
3162 vterm_set_utf8(vterm, 1); | |
3163 | |
3164 init_default_colors(term); | |
3165 | |
3166 vterm_state_set_default_colors( | |
3167 vterm_obtain_state(vterm), | |
3168 &term->tl_default_color.fg, | |
3169 &term->tl_default_color.bg); | |
3157 | 3170 |
3158 /* Required to initialize most things. */ | 3171 /* Required to initialize most things. */ |
3159 vterm_screen_reset(screen, 1 /* hard */); | 3172 vterm_screen_reset(screen, 1 /* hard */); |
3160 | 3173 |
3161 /* Allow using alternate screen. */ | 3174 /* Allow using alternate screen. */ |
3764 term_T *term = buf->b_term; | 3777 term_T *term = buf->b_term; |
3765 int width; | 3778 int width; |
3766 int width2; | 3779 int width2; |
3767 VTermPos cursor_pos1; | 3780 VTermPos cursor_pos1; |
3768 VTermPos cursor_pos2; | 3781 VTermPos cursor_pos2; |
3782 | |
3783 init_default_colors(term); | |
3769 | 3784 |
3770 rettv->vval.v_number = buf->b_fnum; | 3785 rettv->vval.v_number = buf->b_fnum; |
3771 | 3786 |
3772 /* read the files, fill the buffer with the diff */ | 3787 /* read the files, fill the buffer with the diff */ |
3773 width = read_dump_file(fd1, &cursor_pos1); | 3788 width = read_dump_file(fd1, &cursor_pos1); |