diff options
-rw-r--r-- | runtime/doc/options.txt | 24 | ||||
-rw-r--r-- | runtime/doc/term.txt | 33 | ||||
-rw-r--r-- | runtime/doc/various.txt | 4 | ||||
-rw-r--r-- | runtime/syntax/dircolors.vim | 42 | ||||
-rw-r--r-- | src/eval.c | 8 | ||||
-rw-r--r-- | src/feature.h | 4 | ||||
-rw-r--r-- | src/globals.h | 2 | ||||
-rw-r--r-- | src/hardcopy.c | 2 | ||||
-rw-r--r-- | src/option.c | 24 | ||||
-rw-r--r-- | src/option.h | 6 | ||||
-rw-r--r-- | src/proto/term.pro | 6 | ||||
-rw-r--r-- | src/screen.c | 32 | ||||
-rw-r--r-- | src/structs.h | 4 | ||||
-rw-r--r-- | src/syntax.c | 66 | ||||
-rw-r--r-- | src/term.c | 20 | ||||
-rw-r--r-- | src/version.c | 12 | ||||
-rw-r--r-- | src/vim.h | 16 |
17 files changed, 155 insertions, 150 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 8310a68bae..e42116dc5a 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -3477,18 +3477,6 @@ A jump table for the options with a short description can be found at |Q_op|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. - *'guicolors'* *'gcol'* -'guicolors' 'gcol' boolean (default off) - global - {not in Vi} - {not available when compiled without the - |+termtruecolor| feature} - When on, uses |highlight-guifg| and |highlight-guibg| attributes in - the terminal (thus using 24-bit color). Requires a ISO-8613-3 - compatible terminal. - If setting this option does not work (produces a colorless UI) - reading |xterm-true-color| might help. - *'guicursor'* *'gcr'* *E545* *E546* *E548* *E549* 'guicursor' 'gcr' string (default "n-v-c:block-Cursor/lCursor, ve:ver35-Cursor, @@ -7551,6 +7539,18 @@ A jump table for the options with a short description can be found at |Q_op|. :set encoding=utf-8 < You need to do this when your system has no locale support for UTF-8. + *'termguicolors'* *'tgc'* +'termguicolors' 'tgc' boolean (default off) + global + {not in Vi} + {not available when compiled without the + |+termguicolors| feature} + When on, uses |highlight-guifg| and |highlight-guibg| attributes in + the terminal (thus using 24-bit color). Requires a ISO-8613-3 + compatible terminal. + If setting this option does not work (produces a colorless UI) + reading |xterm-true-color| might help. + *'terse'* *'noterse'* 'terse' boolean (default off) global diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index 0ac5b41b35..1eea20f74e 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -1,4 +1,4 @@ -*term.txt* For Vim version 7.4. Last change: 2016 Apr 21 +*term.txt* For Vim version 7.4. Last change: 2016 Apr 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -302,7 +302,6 @@ Added by Vim (there are no standard codes for these): t_u7 request cursor position (for xterm) *t_u7* *'t_u7'* see |'ambiwidth'| t_RB request terminal background color *t_RB* *'t_RB'* - see |'ambiwidth'| t_8f set foreground color (R, G, B) *t_8f* *'t_8f'* |xterm-true-color| t_8b set background color (R, G, B) *t_8b* *'t_8b'* @@ -425,19 +424,23 @@ Vim has started, the escape sequences may not be recognized anymore. *xterm-true-color* Vim supports using true colors in the terminal (taken from |highlight-guifg| -and |highlight-guibg|), given that terminal supports this. To make this -work, 'guicolors' option needs to be set. - -Sometimes setting 'guicolors' is not enough and one has to set the |t_8f| and -|t_8b| options explicitly. Default values of these options are -`^[[38;2;%lu;%lu;%lum` and `^[[48;2;%lu;%lu;%lum` (replace `^[` with real -escape) respectively, but it is only set when `$TERM` is `xterm`. Some -terminals accept the same sequences, but with all semicolons replaced by -colons (this is actually more compatible, but less widely supported). These -options contain printf strings, with |printf()| (actually, its C equivalent -hence `l` modifier) invoked with the t_ option value and three unsigned long -integers that may have any value between 0 and 255 (inclusive) representing -red, green and blue colors respectively. +and |highlight-guibg|), given that the terminal supports this. To make this +work the 'termguicolors' option needs to be set. + +Sometimes setting 'termguicolors' is not enough and one has to set the |t_8f| +and |t_8b| options explicitly. Default values of these options are +"^[[38;2;%lu;%lu;%lum" and "^[[48;2;%lu;%lu;%lum" respectively, but it is only +set when `$TERM` is `xterm`. Some terminals accept the same sequences, but +with all semicolons replaced by colons (this is actually more compatible, but +less widely supported): > + set t_8f=^[[38:2:%lu:%lu:%lum + set t_8b=^[[48:2:%lu:%lu:%lum +(replace `^[` with real escape) + +These options contain printf strings, with |printf()| (actually, its C +equivalent hence `l` modifier) invoked with the t_ option value and three +unsigned long integers that may have any value between 0 and 255 (inclusive) +representing red, green and blue colors respectively. *xterm-resize* Window resizing with xterm only works if the allowWindowOps resource is diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index b73949f98b..1f8e5cd183 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -1,4 +1,4 @@ -*various.txt* For Vim version 7.4. Last change: 2016 Mar 20 +*various.txt* For Vim version 7.4. Last change: 2016 Apr 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -424,7 +424,7 @@ m *+tcl* Tcl interface |tcl| m *+tcl/dyn* Tcl interface |tcl-dynamic| |/dyn| *+terminfo* uses |terminfo| instead of termcap N *+termresponse* support for |t_RV| and |v:termresponse| -m *+termtruecolor* 24-bit color in xterm-compatible terminals support +B *+termguicolors* 24-bit color in xterm-compatible terminals support N *+textobjects* |text-objects| selection *+tgetent* non-Unix only: able to use external termcap N *+timers* the |timer_start()| function diff --git a/runtime/syntax/dircolors.vim b/runtime/syntax/dircolors.vim index c94d720644..1b598c39b5 100644 --- a/runtime/syntax/dircolors.vim +++ b/runtime/syntax/dircolors.vim @@ -44,24 +44,24 @@ highlight default link dircolorsExtension Identifier highlight default link dircolorsEscape Special function! s:set_guicolors() abort - let s:guicolors = {} - - let s:guicolors[0] = "Black" - let s:guicolors[1] = "DarkRed" - let s:guicolors[2] = "DarkGreen" - let s:guicolors[3] = "DarkYellow" - let s:guicolors[4] = "DarkBlue" - let s:guicolors[5] = "DarkMagenta" - let s:guicolors[6] = "DarkCyan" - let s:guicolors[7] = "Gray" - let s:guicolors[8] = "DarkGray" - let s:guicolors[9] = "Red" - let s:guicolors[10] = "Green" - let s:guicolors[11] = "Yellow" - let s:guicolors[12] = "Blue" - let s:guicolors[13] = "Magenta" - let s:guicolors[14] = "Cyan" - let s:guicolors[15] = "White" + let s:termguicolors = {} + + let s:termguicolors[0] = "Black" + let s:termguicolors[1] = "DarkRed" + let s:termguicolors[2] = "DarkGreen" + let s:termguicolors[3] = "DarkYellow" + let s:termguicolors[4] = "DarkBlue" + let s:termguicolors[5] = "DarkMagenta" + let s:termguicolors[6] = "DarkCyan" + let s:termguicolors[7] = "Gray" + let s:termguicolors[8] = "DarkGray" + let s:termguicolors[9] = "Red" + let s:termguicolors[10] = "Green" + let s:termguicolors[11] = "Yellow" + let s:termguicolors[12] = "Blue" + let s:termguicolors[13] = "Magenta" + let s:termguicolors[14] = "Cyan" + let s:termguicolors[15] = "White" let xterm_palette = ["00", "5f", "87", "af", "d7", "ff"] @@ -70,7 +70,7 @@ function! s:set_guicolors() abort for r in xterm_palette for g in xterm_palette for b in xterm_palette - let s:guicolors[cur_col] = '#' . r . g . b + let s:termguicolors[cur_col] = '#' . r . g . b let cur_col += 1 endfor endfor @@ -78,14 +78,14 @@ function! s:set_guicolors() abort for i in range(24) let g = i * 0xa + 8 - let s:guicolors[i + 232] = '#' . g . g . g + let s:termguicolors[i + 232] = '#' . g . g . g endfor endfunction function! s:get_hi_str(color, place) abort if a:color >= 0 && a:color <= 255 if has('gui_running') - return ' gui' . a:place . '=' . s:guicolors[a:color] + return ' gui' . a:place . '=' . s:termguicolors[a:color] elseif a:color <= 7 || &t_Co == 256 || &t_Co == 88 return ' cterm' . a:place . '=' . a:color endif diff --git a/src/eval.c b/src/eval.c index 7abb62be82..b3a3b415a5 100644 --- a/src/eval.c +++ b/src/eval.c @@ -14042,15 +14042,15 @@ f_has(typval_T *argvars, typval_T *rettv) "tcl", # endif #endif +#ifdef FEAT_TERMGUICOLORS + "termguicolors", +#endif #ifdef TERMINFO "terminfo", #endif #ifdef FEAT_TERMRESPONSE "termresponse", #endif -#ifdef FEAT_TERMTRUECOLOR - "termtruecolor", -#endif #ifdef FEAT_TEXTOBJ "textobjects", #endif @@ -20019,7 +20019,7 @@ f_synIDattr(typval_T *argvars UNUSED, typval_T *rettv) } else { -#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) if (USE_24BIT) modec = 'g'; else diff --git a/src/feature.h b/src/feature.h index d3d768eb37..54f665f40a 100644 --- a/src/feature.h +++ b/src/feature.h @@ -815,10 +815,10 @@ #endif /* - * +termtruecolor 'guicolor' option. + * +termguicolors 'termguicolors' option. */ #if (defined(FEAT_BIG) && defined(FEAT_SYN_HL)) && !defined(ALWAYS_USE_GUI) -# define FEAT_TERMTRUECOLOR +# define FEAT_TERMGUICOLORS #endif /* Mac specific thing: Codewarrior interface. */ diff --git a/src/globals.h b/src/globals.h index 8cc9bedf9b..5010cd4aee 100644 --- a/src/globals.h +++ b/src/globals.h @@ -369,7 +369,7 @@ EXTERN char_u *use_gvimrc INIT(= NULL); /* "-U" cmdline argument */ EXTERN int cterm_normal_fg_color INIT(= 0); EXTERN int cterm_normal_fg_bold INIT(= 0); EXTERN int cterm_normal_bg_color INIT(= 0); -#ifdef FEAT_TERMTRUECOLOR +#ifdef FEAT_TERMGUICOLORS EXTERN long_u cterm_normal_fg_gui_color INIT(= INVALCOLOR); EXTERN long_u cterm_normal_bg_gui_color INIT(= INVALCOLOR); #endif diff --git a/src/hardcopy.c b/src/hardcopy.c index aaa20102c8..55b3b15241 100644 --- a/src/hardcopy.c +++ b/src/hardcopy.c @@ -307,7 +307,7 @@ prt_get_attr( pattr->underline = (highlight_has_attr(hl_id, HL_UNDERLINE, modec) != NULL); pattr->undercurl = (highlight_has_attr(hl_id, HL_UNDERCURL, modec) != NULL); -# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) if (USE_24BIT) { bg_color = highlight_gui_color_rgb(hl_id, FALSE); diff --git a/src/option.c b/src/option.c index da02864123..d048cecd30 100644 --- a/src/option.c +++ b/src/option.c @@ -1305,15 +1305,6 @@ static struct vimoption options[] = {(char_u *)NULL, (char_u *)0L} #endif SCRIPTID_INIT}, - {"guicolors", "gcol", P_BOOL|P_VI_DEF|P_VIM|P_RCLR, -#ifdef FEAT_TERMTRUECOLOR - (char_u *)&p_guicolors, PV_NONE, - {(char_u *)FALSE, (char_u *)FALSE} -#else - (char_u*)NULL, PV_NONE, - {(char_u *)FALSE, (char_u *)FALSE} -#endif - SCRIPTID_INIT}, {"guicursor", "gcr", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, #ifdef CURSOR_SHAPE (char_u *)&p_guicursor, PV_NONE, @@ -2625,6 +2616,15 @@ static struct vimoption options[] = {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, + {"termguicolors", "tgc", P_BOOL|P_VI_DEF|P_VIM|P_RCLR, +#ifdef FEAT_TERMGUICOLORS + (char_u *)&p_tgc, PV_NONE, + {(char_u *)FALSE, (char_u *)FALSE} +#else + (char_u*)NULL, PV_NONE, + {(char_u *)FALSE, (char_u *)FALSE} +#endif + SCRIPTID_INIT}, {"terse", NULL, P_BOOL|P_VI_DEF, (char_u *)&p_terse, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, @@ -8364,9 +8364,9 @@ set_bool_option( #endif -#ifdef FEAT_TERMTRUECOLOR - /* 'guicolors' */ - else if ((int *)varp == &p_guicolors) +#ifdef FEAT_TERMGUICOLORS + /* 'termguicolors' */ + else if ((int *)varp == &p_tgc) { # ifdef FEAT_GUI if (!gui.in_use && !gui.starting) diff --git a/src/option.h b/src/option.h index 60889ab432..6fba8b8318 100644 --- a/src/option.h +++ b/src/option.h @@ -527,9 +527,6 @@ EXTERN char_u *p_popt; /* 'printoptions' */ EXTERN char_u *p_header; /* 'printheader' */ #endif EXTERN int p_prompt; /* 'prompt' */ -#ifdef FEAT_TERMTRUECOLOR -EXTERN int p_guicolors; /* 'guicolors' */ -#endif #ifdef FEAT_GUI EXTERN char_u *p_guifont; /* 'guifont' */ # ifdef FEAT_XFONTSET @@ -843,6 +840,9 @@ EXTERN int p_tbidi; /* 'termbidi' */ #ifdef FEAT_MBYTE EXTERN char_u *p_tenc; /* 'termencoding' */ #endif +#ifdef FEAT_TERMGUICOLORS +EXTERN int p_tgc; /* 'termguicolors' */ +#endif EXTERN int p_terse; /* 'terse' */ EXTERN int p_ta; /* 'textauto' */ EXTERN int p_to; /* 'tildeop' */ diff --git a/src/proto/term.pro b/src/proto/term.pro index 3984515446..93c6cb09bc 100644 --- a/src/proto/term.pro +++ b/src/proto/term.pro @@ -1,7 +1,7 @@ /* term.c */ -guicolor_T termtrue_mch_get_color(char_u *name); -guicolor_T termtrue_get_color(char_u *name); -long_u termtrue_mch_get_rgb(guicolor_T color); +guicolor_T termgui_mch_get_color(char_u *name); +guicolor_T termgui_get_color(char_u *name); +long_u termgui_mch_get_rgb(guicolor_T color); int set_termname(char_u *term); void set_mouse_termcode(int n, char_u *s); void del_mouse_termcode(int n); diff --git a/src/screen.c b/src/screen.c index ee348e9b53..a72bffa536 100644 --- a/src/screen.c +++ b/src/screen.c @@ -7840,12 +7840,12 @@ screen_start_highlight(int attr) if ((attr & HL_BOLD) && T_MD != NULL) /* bold */ out_str(T_MD); else if (aep != NULL && cterm_normal_fg_bold && -#ifdef FEAT_TERMTRUECOLOR - (p_guicolors ? +#ifdef FEAT_TERMGUICOLORS + (p_tgc ? (aep->ae_u.cterm.fg_rgb != (long_u)INVALCOLOR): #endif (t_colors > 1 && aep->ae_u.cterm.fg_color) -#ifdef FEAT_TERMTRUECOLOR +#ifdef FEAT_TERMGUICOLORS ) #endif ) @@ -7868,8 +7868,8 @@ screen_start_highlight(int attr) */ if (aep != NULL) { -#ifdef FEAT_TERMTRUECOLOR - if (p_guicolors) +#ifdef FEAT_TERMGUICOLORS + if (p_tgc) { if (aep->ae_u.cterm.fg_rgb != (long_u)INVALCOLOR) term_fg_rgb_color(aep->ae_u.cterm.fg_rgb); @@ -7931,13 +7931,13 @@ screen_stop_highlight(void) */ aep = syn_cterm_attr2entry(screen_attr); if (aep != NULL && -#ifdef FEAT_TERMTRUECOLOR - (p_guicolors ? +#ifdef FEAT_TERMGUICOLORS + (p_tgc ? (aep->ae_u.cterm.fg_rgb != (long_u)INVALCOLOR || aep->ae_u.cterm.bg_rgb != (long_u)INVALCOLOR): #endif (aep->ae_u.cterm.fg_color || aep->ae_u.cterm.bg_color) -#ifdef FEAT_TERMTRUECOLOR +#ifdef FEAT_TERMGUICOLORS ) #endif ) @@ -7988,8 +7988,8 @@ screen_stop_highlight(void) if (do_ME || (screen_attr & (HL_BOLD | HL_INVERSE))) out_str(T_ME); -#ifdef FEAT_TERMTRUECOLOR - if (p_guicolors) +#ifdef FEAT_TERMGUICOLORS + if (p_tgc) { if (cterm_normal_fg_gui_color != (long_u)INVALCOLOR) term_fg_rgb_color(cterm_normal_fg_gui_color); @@ -8025,8 +8025,8 @@ reset_cterm_colors(void) if (IS_CTERM) { /* set Normal cterm colors */ -#ifdef FEAT_TERMTRUECOLOR - if (p_guicolors ? +#ifdef FEAT_TERMGUICOLORS + if (p_tgc ? (cterm_normal_fg_gui_color != (long_u)INVALCOLOR || cterm_normal_bg_gui_color != (long_u)INVALCOLOR): (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0)) @@ -8959,8 +8959,8 @@ can_clear(char_u *p) #ifdef FEAT_GUI || gui.in_use #endif -#ifdef FEAT_TERMTRUECOLOR - || (p_guicolors && cterm_normal_bg_gui_color != (long_u)INVALCOLOR) +#ifdef FEAT_TERMGUICOLORS + || (p_tgc && cterm_normal_bg_gui_color != (long_u)INVALCOLOR) #endif || cterm_normal_bg_color == 0 || *T_UT != NUL)); } @@ -10293,8 +10293,8 @@ draw_tabline(void) #ifdef FEAT_GUI && !gui.in_use #endif -#ifdef FEAT_TERMTRUECOLOR - && !p_guicolors +#ifdef FEAT_TERMGUICOLORS + && !p_tgc #endif ); diff --git a/src/structs.h b/src/structs.h index 1775256996..50901acd57 100644 --- a/src/structs.h +++ b/src/structs.h @@ -85,7 +85,7 @@ typedef struct file_buffer buf_T; /* forward declaration */ # include <X11/Intrinsic.h> # endif # define guicolor_T long_u /* avoid error in prototypes and - * make FEAT_TERMTRUECOLOR work */ + * make FEAT_TERMGUICOLORS work */ # define INVALCOLOR ((guicolor_T)0x1ffffff) #endif @@ -913,7 +913,7 @@ typedef struct attr_entry /* These colors need to be > 8 bits to hold 256. */ short_u fg_color; /* foreground color number */ short_u bg_color; /* background color number */ -# ifdef FEAT_TERMTRUECOLOR +# ifdef FEAT_TERMGUICOLORS long_u fg_rgb; /* foreground color RGB */ long_u bg_rgb; /* background color RGB */ # endif diff --git a/src/syntax.c b/src/syntax.c index ea4e74c66d..7d4e7b1e2f 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -34,7 +34,7 @@ struct hl_group int sg_cterm_bg; /* terminal bg color number + 1 */ int sg_cterm_attr; /* Screen attr for color term mode */ /* for when using the GUI */ -#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) guicolor_T sg_gui_fg; /* GUI foreground color handle */ guicolor_T sg_gui_bg; /* GUI background color handle */ #endif @@ -99,7 +99,7 @@ static int syn_list_header(int did_header, int outlen, int id); static int hl_has_settings(int idx, int check_link); static void highlight_clear(int idx); -#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) static void gui_do_one_color(int idx, int do_menu, int do_tooltip); static guicolor_T color_name2handle(char_u *name); #endif @@ -7337,7 +7337,7 @@ do_highlight( for (idx = 0; idx < highlight_ga.ga_len; ++idx) highlight_clear(idx); init_highlight(TRUE, TRUE); -#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) if (USE_24BIT) highlight_gui_started(); #endif @@ -7792,14 +7792,14 @@ do_highlight( if (!init) HL_TABLE()[idx].sg_set |= SG_GUI; -# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) /* In GUI guifg colors are only used when recognized */ i = color_name2handle(arg); if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 # ifdef FEAT_GUI || !(USE_24BIT) # else - || !p_guicolors + || !p_tgc # endif ) { @@ -7810,7 +7810,7 @@ do_highlight( HL_TABLE()[idx].sg_gui_fg_name = vim_strsave(arg); else HL_TABLE()[idx].sg_gui_fg_name = NULL; -# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) # ifdef FEAT_GUI_X11 if (is_menu_group) gui.menu_fg_pixel = i; @@ -7835,7 +7835,7 @@ do_highlight( if (!init) HL_TABLE()[idx].sg_set |= SG_GUI; -# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) /* In GUI guifg colors are only used when recognized */ i = color_name2handle(arg); if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT) @@ -7847,7 +7847,7 @@ do_highlight( HL_TABLE()[idx].sg_gui_bg_name = vim_strsave(arg); else HL_TABLE()[idx].sg_gui_bg_name = NULL; -# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) # ifdef FEAT_GUI_X11 if (is_menu_group) gui.menu_bg_pixel = i; @@ -8008,7 +8008,7 @@ do_highlight( * and/or "fg", which have been changed now. */ #endif -#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) if (USE_24BIT) highlight_gui_started(); #endif @@ -8080,7 +8080,7 @@ restore_cterm_colors(void) cterm_normal_fg_color = 0; cterm_normal_fg_bold = 0; cterm_normal_bg_color = 0; -# ifdef FEAT_TERMTRUECOLOR +# ifdef FEAT_TERMGUICOLORS cterm_normal_fg_gui_color = INVALCOLOR; cterm_normal_bg_gui_color = INVALCOLOR; # endif @@ -8134,7 +8134,7 @@ highlight_clear(int idx) vim_free(HL_TABLE()[idx].sg_gui_sp_name); HL_TABLE()[idx].sg_gui_sp_name = NULL; #endif -#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) HL_TABLE()[idx].sg_gui_fg = INVALCOLOR; HL_TABLE()[idx].sg_gui_bg = INVALCOLOR; #endif @@ -8158,7 +8158,7 @@ highlight_clear(int idx) #endif } -#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) || defined(PROTO) +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) /* * Set the normal foreground and background colors according to the "Normal" * highlighting group. For X11 also set "Menu", "Scrollbar", and @@ -8168,7 +8168,7 @@ highlight_clear(int idx) set_normal_colors(void) { #ifdef FEAT_GUI -# ifdef FEAT_TERMTRUECOLOR +# ifdef FEAT_TERMGUICOLORS if (gui.in_use) # endif { @@ -8210,7 +8210,7 @@ set_normal_colors(void) # endif } #endif -#ifdef FEAT_TERMTRUECOLOR +#ifdef FEAT_TERMGUICOLORS # ifdef FEAT_GUI else # endif @@ -8473,7 +8473,7 @@ hl_do_font( #endif /* FEAT_GUI */ -#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) || defined(PROTO) +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) /* * Return the handle for a color name. * Returns INVALCOLOR when failed. @@ -8486,31 +8486,31 @@ color_name2handle(char_u *name) if (STRICMP(name, "fg") == 0 || STRICMP(name, "foreground") == 0) { -#if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI) +#if defined(FEAT_TERMGUICOLORS) && defined(FEAT_GUI) if (gui.in_use) #endif #ifdef FEAT_GUI return gui.norm_pixel; #endif -#if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI) +#if defined(FEAT_TERMGUICOLORS) && defined(FEAT_GUI) else #endif -#ifdef FEAT_TERMTRUECOLOR +#ifdef FEAT_TERMGUICOLORS return cterm_normal_fg_gui_color; #endif } if (STRICMP(name, "bg") == 0 || STRICMP(name, "background") == 0) { -#if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI) +#if defined(FEAT_TERMGUICOLORS) && defined(FEAT_GUI) if (gui.in_use) #endif #ifdef FEAT_GUI return gui.back_pixel; #endif -#if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI) +#if defined(FEAT_TERMGUICOLORS) && defined(FEAT_GUI) else #endif -#ifdef FEAT_TERMTRUECOLOR +#ifdef FEAT_TERMGUICOLORS return cterm_normal_bg_gui_color; #endif } @@ -8595,7 +8595,7 @@ get_attr_entry(garray_T *table, attrentry_T *aep) == taep->ae_u.cterm.fg_color && aep->ae_u.cterm.bg_color == taep->ae_u.cterm.bg_color -#ifdef FEAT_TERMTRUECOLOR +#ifdef FEAT_TERMGUICOLORS && aep->ae_u.cterm.fg_rgb == taep->ae_u.cterm.fg_rgb && aep->ae_u.cterm.bg_rgb @@ -8667,7 +8667,7 @@ get_attr_entry(garray_T *table, attrentry_T *aep) { taep->ae_u.cterm.fg_color = aep->ae_u.cterm.fg_color; taep->ae_u.cterm.bg_color = aep->ae_u.cterm.bg_color; -#ifdef FEAT_TERMTRUECOLOR +#ifdef FEAT_TERMGUICOLORS taep->ae_u.cterm.fg_rgb = aep->ae_u.cterm.fg_rgb; taep->ae_u.cterm.bg_rgb = aep->ae_u.cterm.bg_rgb; #endif @@ -8787,7 +8787,7 @@ hl_combine_attr(int char_attr, int prim_attr) new_en.ae_u.cterm.fg_color = spell_aep->ae_u.cterm.fg_color; if (spell_aep->ae_u.cterm.bg_color > 0) new_en.ae_u.cterm.bg_color = spell_aep->ae_u.cterm.bg_color; -#ifdef FEAT_TERMTRUECOLOR +#ifdef FEAT_TERMGUICOLORS if (spell_aep->ae_u.cterm.fg_rgb != (long_u)INVALCOLOR) new_en.ae_u.cterm.fg_rgb = spell_aep->ae_u.cterm.fg_rgb; if (spell_aep->ae_u.cterm.bg_rgb != (long_u)INVALCOLOR) @@ -9056,7 +9056,7 @@ highlight_color( return NULL; if (modec == 'g') { -# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) # ifdef FEAT_GUI /* return font name */ if (font) @@ -9115,7 +9115,7 @@ highlight_color( #endif #if (defined(FEAT_SYN_HL) \ - && (defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)) \ + && (defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)) \ && defined(FEAT_PRINTER)) || defined(PROTO) /* * Return color name of highlight group "id" as RGB value. @@ -9255,7 +9255,7 @@ set_hl_attr( * highlighting attributes, need to allocate an attr number. */ if (sgp->sg_cterm_fg == 0 && sgp->sg_cterm_bg == 0 -# ifdef FEAT_TERMTRUECOLOR +# ifdef FEAT_TERMGUICOLORS && sgp->sg_gui_fg == INVALCOLOR && sgp->sg_gui_bg == INVALCOLOR # endif @@ -9266,7 +9266,7 @@ set_hl_attr( at_en.ae_attr = sgp->sg_cterm; at_en.ae_u.cterm.fg_color = sgp->sg_cterm_fg; at_en.ae_u.cterm.bg_color = sgp->sg_cterm_bg; -# ifdef FEAT_TERMTRUECOLOR +# ifdef FEAT_TERMGUICOLORS at_en.ae_u.cterm.fg_rgb = GUI_MCH_GET_RGB(sgp->sg_gui_fg); at_en.ae_u.cterm.bg_rgb = GUI_MCH_GET_RGB(sgp->sg_gui_bg); # endif @@ -9420,7 +9420,7 @@ syn_add_group(char_u *name) vim_memset(&(HL_TABLE()[highlight_ga.ga_len]), 0, sizeof(struct hl_group)); HL_TABLE()[highlight_ga.ga_len].sg_name = name; HL_TABLE()[highlight_ga.ga_len].sg_name_u = vim_strsave_up(name); -#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) HL_TABLE()[highlight_ga.ga_len].sg_gui_bg = INVALCOLOR; HL_TABLE()[highlight_ga.ga_len].sg_gui_fg = INVALCOLOR; # ifdef FEAT_GUI @@ -9518,7 +9518,7 @@ syn_get_final_id(int hl_id) return hl_id; } -#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) /* * Call this function just after the GUI has started. * It finds the font and color handles for the highlighting groups. @@ -9529,8 +9529,8 @@ highlight_gui_started(void) int idx; /* First get the colors from the "Normal" and "Menu" group, if set */ -# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) -# ifdef FEAT_TERMTRUECOLOR +# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) +# ifdef FEAT_TERMGUICOLORS if (USE_24BIT) # endif set_normal_colors(); @@ -9551,7 +9551,7 @@ gui_do_one_color( int didit = FALSE; # ifdef FEAT_GUI -# ifdef FEAT_TERMTRUECOLOR +# ifdef FEAT_TERMGUICOLORS if (gui.in_use) # endif if (HL_TABLE()[idx].sg_font_name != NULL) diff --git a/src/term.c b/src/term.c index 3c8c0fa02b..4af9aeb846 100644 --- a/src/term.c +++ b/src/term.c @@ -77,7 +77,7 @@ struct builtin_term static struct builtin_term *find_builtin_term(char_u *name); static void parse_builtin_tcap(char_u *s); static void term_color(char_u *s, int n); -#ifdef FEAT_TERMTRUECOLOR +#ifdef FEAT_TERMGUICOLORS static void term_rgb_color(char_u *s, long_u rgb); #endif static void gather_termleader(void); @@ -859,7 +859,7 @@ static struct builtin_term builtin_termcaps[] = {(int)KS_CRV, IF_EB("\033[>c", ESC_STR "[>c")}, {(int)KS_RBG, IF_EB("\033]11;?\007", ESC_STR "]11;?\007")}, {(int)KS_U7, IF_EB("\033[6n", ESC_STR "[6n")}, -# ifdef FEAT_TERMTRUECOLOR +# ifdef FEAT_TERMGUICOLORS /* These are printf strings, not terminal codes. */ {(int)KS_8F, IF_EB("\033[38;2;%lu;%lu;%lum", ESC_STR "[38;2;%lu;%lu;%lum")}, {(int)KS_8B, IF_EB("\033[48;2;%lu;%lu;%lum", ESC_STR "[48;2;%lu;%lu;%lum")}, @@ -1265,21 +1265,21 @@ static struct builtin_term builtin_termcaps[] = }; /* end of builtin_termcaps */ -#if defined(FEAT_TERMTRUECOLOR) || defined(PROTO) +#if defined(FEAT_TERMGUICOLORS) || defined(PROTO) guicolor_T -termtrue_mch_get_color(char_u *name) +termgui_mch_get_color(char_u *name) { return gui_get_color_cmn(name); } guicolor_T -termtrue_get_color(char_u *name) +termgui_get_color(char_u *name) { guicolor_T t; if (*name == NUL) return INVALCOLOR; - t = termtrue_mch_get_color(name); + t = termgui_mch_get_color(name); if (t == INVALCOLOR) EMSG2(_("E254: Cannot allocate color %s"), name); @@ -1287,9 +1287,9 @@ termtrue_get_color(char_u *name) } long_u -termtrue_mch_get_rgb(guicolor_T color) +termgui_mch_get_rgb(guicolor_T color) { - return (long_u) color; + return (long_u)color; } #endif @@ -2645,7 +2645,7 @@ term_color(char_u *s, int n) OUT_STR(tgoto((char *)s, 0, n)); } -#if defined(FEAT_TERMTRUECOLOR) || defined(PROTO) +#if defined(FEAT_TERMGUICOLORS) || defined(PROTO) void term_fg_rgb_color(long_u rgb) { @@ -6053,7 +6053,7 @@ update_tcap(int attr) } #endif -#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) || defined(PROTO) +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) static int hex_digit(int c) { diff --git a/src/version.c b/src/version.c index 44f37a7fc6..5a094475dd 100644 --- a/src/version.c +++ b/src/version.c @@ -602,6 +602,11 @@ static char *(features[]) = #else "-tcl", #endif +#ifdef FEAT_TERMGUICOLORS + "+termguicolors", +#else + "-termguicolors", +#endif #if defined(UNIX) || defined(__EMX__) /* only Unix (or OS/2 with EMX!) can have terminfo instead of termcap */ # ifdef TERMINFO @@ -621,11 +626,6 @@ static char *(features[]) = #else "-termresponse", #endif -#ifdef FEAT_TERMTRUECOLOR - "+termtruecolor", -#else - "-termtruecolor", -#endif #ifdef FEAT_TEXTOBJ "+textobjects", #else @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1799, +/**/ 1798, /**/ 1797, @@ -1559,21 +1559,21 @@ typedef UINT32_TYPEDEF UINT32_T; #define MSG_PUTS_LONG_ATTR(s, a) msg_puts_long_attr((char_u *)(s), (a)) #ifdef FEAT_GUI -# ifdef FEAT_TERMTRUECOLOR -# define GUI_FUNCTION(f) (gui.in_use ? gui_##f : termtrue_##f) -# define USE_24BIT (gui.in_use || p_guicolors) +# ifdef FEAT_TERMGUICOLORS +# define GUI_FUNCTION(f) (gui.in_use ? gui_##f : termgui_##f) +# define USE_24BIT (gui.in_use || p_tgc) # else # define GUI_FUNCTION(f) gui_##f # define USE_24BIT gui.in_use # endif #else -# ifdef FEAT_TERMTRUECOLOR -# define GUI_FUNCTION(f) termtrue_##f -# define USE_24BIT p_guicolors +# ifdef FEAT_TERMGUICOLORS +# define GUI_FUNCTION(f) termgui_##f +# define USE_24BIT p_tgc # endif #endif -#ifdef FEAT_TERMTRUECOLOR -# define IS_CTERM (t_colors > 1 || p_guicolors) +#ifdef FEAT_TERMGUICOLORS +# define IS_CTERM (t_colors > 1 || p_tgc) #else # define IS_CTERM (t_colors > 1) #endif |