Hi Bram and list. I think that 'guicolors' option name does not intuitive. This option for terminal, but prefix is 'gui' I think it's unnatural.
I propose to rename option name to 'termtruecolor'. (Short name is 'ttc') How about this? NOTE: This has been first proposed by Ken Takada. Patch attached. Please check this. -- Best regards, Hirohito Higashi (a.k.a. h_east) -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 8310a68..466119e 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. + *'termtruecolor'* *'ttc'* +'termtruecolor' 'ttc' 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. + *'terse'* *'noterse'* 'terse' boolean (default off) global diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index 0ac5b41..705cf3f 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -426,9 +426,9 @@ 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. +work, 'termtruecolor' option needs to be set. -Sometimes setting 'guicolors' is not enough and one has to set the |t_8f| and +Sometimes setting 'termtruecolor' 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 diff --git a/runtime/syntax/dircolors.vim b/runtime/syntax/dircolors.vim index c94d720..c32fcf1 100644 --- a/runtime/syntax/dircolors.vim +++ b/runtime/syntax/dircolors.vim @@ -43,25 +43,25 @@ highlight default link dircolorsKeyword Keyword 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" +function! s:set_termtruecolor() abort + let s:termtruecolor = {} + + let s:termtruecolor[0] = "Black" + let s:termtruecolor[1] = "DarkRed" + let s:termtruecolor[2] = "DarkGreen" + let s:termtruecolor[3] = "DarkYellow" + let s:termtruecolor[4] = "DarkBlue" + let s:termtruecolor[5] = "DarkMagenta" + let s:termtruecolor[6] = "DarkCyan" + let s:termtruecolor[7] = "Gray" + let s:termtruecolor[8] = "DarkGray" + let s:termtruecolor[9] = "Red" + let s:termtruecolor[10] = "Green" + let s:termtruecolor[11] = "Yellow" + let s:termtruecolor[12] = "Blue" + let s:termtruecolor[13] = "Magenta" + let s:termtruecolor[14] = "Cyan" + let s:termtruecolor[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:termtruecolor[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:termtruecolor[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:termtruecolor[a:color] elseif a:color <= 7 || &t_Co == 256 || &t_Co == 88 return ' cterm' . a:place . '=' . a:color endif @@ -200,7 +200,7 @@ endfunction let b:dc_next_index = 0 if has('gui_running') - call s:set_guicolors() + call s:set_termtruecolor() endif if has('gui_running') || &t_Co != '' diff --git a/src/option.c b/src/option.c index da02864..e483329 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}, + {"termtruecolor", "ttc", P_BOOL|P_VI_DEF|P_VIM|P_RCLR, +#ifdef FEAT_TERMTRUECOLOR + (char_u *)&p_ttc, 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}, @@ -8365,8 +8365,8 @@ set_bool_option( #endif #ifdef FEAT_TERMTRUECOLOR - /* 'guicolors' */ - else if ((int *)varp == &p_guicolors) + /* 'termtruecolor' */ + else if ((int *)varp == &p_ttc) { # ifdef FEAT_GUI if (!gui.in_use && !gui.starting) diff --git a/src/option.h b/src/option.h index 60889ab..582741c 100644 --- a/src/option.h +++ b/src/option.h @@ -528,7 +528,7 @@ EXTERN char_u *p_header; /* 'printheader' */ #endif EXTERN int p_prompt; /* 'prompt' */ #ifdef FEAT_TERMTRUECOLOR -EXTERN int p_guicolors; /* 'guicolors' */ +EXTERN int p_ttc; /* 'termtruecolor' */ #endif #ifdef FEAT_GUI EXTERN char_u *p_guifont; /* 'guifont' */ diff --git a/src/screen.c b/src/screen.c index ee348e9..e1b698e 100644 --- a/src/screen.c +++ b/src/screen.c @@ -7841,7 +7841,7 @@ screen_start_highlight(int attr) out_str(T_MD); else if (aep != NULL && cterm_normal_fg_bold && #ifdef FEAT_TERMTRUECOLOR - (p_guicolors ? + (p_ttc ? (aep->ae_u.cterm.fg_rgb != (long_u)INVALCOLOR): #endif (t_colors > 1 && aep->ae_u.cterm.fg_color) @@ -7869,7 +7869,7 @@ screen_start_highlight(int attr) if (aep != NULL) { #ifdef FEAT_TERMTRUECOLOR - if (p_guicolors) + if (p_ttc) { if (aep->ae_u.cterm.fg_rgb != (long_u)INVALCOLOR) term_fg_rgb_color(aep->ae_u.cterm.fg_rgb); @@ -7932,7 +7932,7 @@ screen_stop_highlight(void) aep = syn_cterm_attr2entry(screen_attr); if (aep != NULL && #ifdef FEAT_TERMTRUECOLOR - (p_guicolors ? + (p_ttc ? (aep->ae_u.cterm.fg_rgb != (long_u)INVALCOLOR || aep->ae_u.cterm.bg_rgb != (long_u)INVALCOLOR): #endif @@ -7989,7 +7989,7 @@ screen_stop_highlight(void) out_str(T_ME); #ifdef FEAT_TERMTRUECOLOR - if (p_guicolors) + if (p_ttc) { if (cterm_normal_fg_gui_color != (long_u)INVALCOLOR) term_fg_rgb_color(cterm_normal_fg_gui_color); @@ -8026,7 +8026,7 @@ reset_cterm_colors(void) { /* set Normal cterm colors */ #ifdef FEAT_TERMTRUECOLOR - if (p_guicolors ? + if (p_ttc ? (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)) @@ -8960,7 +8960,7 @@ can_clear(char_u *p) || gui.in_use #endif #ifdef FEAT_TERMTRUECOLOR - || (p_guicolors && cterm_normal_bg_gui_color != (long_u)INVALCOLOR) + || (p_ttc && cterm_normal_bg_gui_color != (long_u)INVALCOLOR) #endif || cterm_normal_bg_color == 0 || *T_UT != NUL)); } @@ -10294,7 +10294,7 @@ draw_tabline(void) && !gui.in_use #endif #ifdef FEAT_TERMTRUECOLOR - && !p_guicolors + && !p_ttc #endif ); diff --git a/src/syntax.c b/src/syntax.c index ea4e74c..1c66ffb 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -7799,7 +7799,7 @@ do_highlight( # ifdef FEAT_GUI || !(USE_24BIT) # else - || !p_guicolors + || !p_ttc # endif ) { diff --git a/src/vim.h b/src/vim.h index f503ebf..65e3c1a 100644 --- a/src/vim.h +++ b/src/vim.h @@ -1561,7 +1561,7 @@ typedef UINT32_TYPEDEF UINT32_T; #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) +# define USE_24BIT (gui.in_use || p_ttc) # else # define GUI_FUNCTION(f) gui_##f # define USE_24BIT gui.in_use @@ -1569,11 +1569,11 @@ typedef UINT32_TYPEDEF UINT32_T; #else # ifdef FEAT_TERMTRUECOLOR # define GUI_FUNCTION(f) termtrue_##f -# define USE_24BIT p_guicolors +# define USE_24BIT p_ttc # endif #endif #ifdef FEAT_TERMTRUECOLOR -# define IS_CTERM (t_colors > 1 || p_guicolors) +# define IS_CTERM (t_colors > 1 || p_ttc) #else # define IS_CTERM (t_colors > 1) #endif