Update: merged with upstream and extended documentation regarding &t_8f and
&t_8b.
diff -r 03a813f2cf51 -r 64d20b6d9488 runtime/doc/options.txt
--- a/runtime/doc/options.txt Thu Nov 20 23:07:05 2014 +0100
+++ b/runtime/doc/options.txt Sat Nov 22 18:38:22 2014 +0300
@@ -3401,6 +3401,18 @@
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
+ terminal (thus using 24-bit color). Requires ISO-8613-3 compatible
+ terminal.
+ If just setting this option does not work (produces 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,
diff -r 03a813f2cf51 -r 64d20b6d9488 runtime/doc/term.txt
--- a/runtime/doc/term.txt Thu Nov 20 23:07:05 2014 +0100
+++ b/runtime/doc/term.txt Sat Nov 22 18:38:22 2014 +0300
@@ -296,6 +296,10 @@
|xterm-8bit| |v:termresponse| |'ttymouse'| |xterm-codes|
t_u7 request cursor position (for xterm) *t_u7* *'t_u7'*
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'*
+ |xterm-true-color|
KEY CODES
Note: Use the <> form if possible
@@ -412,6 +416,21 @@
Note: This is only done on startup. If the xterm options are changed after
Vim has started, the escape sequences may not be recognized any more.
+ *xterm-true-color*
+Vim supports using true colors in terminal (taken from |highlight-guifg| and
+|highlight-guibg|), given that terminal supports this as well. To make this
+work 'guicolors' option needs to be set. Sometimes setting it is not enough
+and one may have to set |t_8f| and |t_8b| options explicitly for GUI colors to
+work. 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 only 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.
+
*xterm-resize*
Window resizing with xterm only works if the allowWindowOps resource is
enabled. On some systems and versions of xterm it's disabled by default
diff -r 03a813f2cf51 -r 64d20b6d9488 runtime/doc/various.txt
--- a/runtime/doc/various.txt Thu Nov 20 23:07:05 2014 +0100
+++ b/runtime/doc/various.txt Sat Nov 22 18:38:22 2014 +0300
@@ -428,6 +428,7 @@
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
N *+textobjects* |text-objects| selection
*+tgetent* non-Unix only: able to use external termcap
N *+title* Setting the window 'title' and 'icon'
diff -r 03a813f2cf51 -r 64d20b6d9488 runtime/syntax/vim.vim
--- a/runtime/syntax/vim.vim Thu Nov 20 23:07:05 2014 +0100
+++ b/runtime/syntax/vim.vim Sat Nov 22 18:38:22 2014 +0300
@@ -33,21 +33,21 @@
syn keyword vimOption contained al antialias autochdir background
balloondelay bexpr bk bs casemap cf cink cmdheight colorcolumn completefunc
copyindent cryptmethod cscopeverbose csverb debug dict dir eb enc errorbells
expandtab fdl fenc fileencodings fkmap foldenable foldminlines formatprg
gdefault gp guifontset helpfile hidden hl ignorecase imcmdline imsf indentexpr
is isp keywordprg lazyredraw lispwords ls makeef maxmapdepth mfd mmd modified
mousemodel msm numberwidth operatorfunc pastetoggle pexpr pmbfn printexpr pt re
restorescreen rnu rulerformat scr sect sft shellredir shiftwidth showmatch siso
smc spc spl ss statusline suffixesadd sws tabline tags tbs textmode timeoutlen
to tsl ttyfast uc undoreload vdir viewoptions warn wfh wig wildmode winfixwidth
wiw wrap writedelay
syn keyword vimOption contained aleph ar autoindent backspace
ballooneval bg bkc bsdir cb cfu cinkeys cmdwinheight columns completeopt cot
cscopepathcomp cspc cuc deco dictionary directory ed encoding errorfile exrc
fdls fencs fileformat flp foldexpr foldnestmax fp gfm grepformat guifontwide
helpheight highlight hlg im imd imstatusfunc indentkeys isf isprint km lbr list
lsp makeprg maxmem mh mmp more mouses mzq nuw opfunc patchexpr pfn popt
printfont pumheight readonly revins ro runtimepath scroll sections sh
shellslash shm showmode sj smd spell splitbelow ssl stl sw sxe tabpagemax
tagstack tenc textwidth title toolbar tsr ttym udf updatecount ve viminfo wb
wfw wildchar wildoptions winheight wm wrapmargin ws
syn keyword vimOption contained allowrevins arab autoread backup
balloonexpr bh bl bsk cc ch cino cmp com concealcursor cp cscopeprg csprg cul
def diff display edcompatible endofline errorformat fcl fdm fex fileformats fml
foldignore foldopen fs gfn grepprg guiheadroom helplang history hls
imactivatefunc imdisable inc indk isfname joinspaces kmp lcs listchars lw mat
maxmempattern mis mmt mouse mouseshape mzquantum odev osfiletype patchmode ph
preserveindent printheader pvh redrawtime ri rs sb scrollbind secure shcf
shelltemp shortmess showtabline slm sn spellcapcheck splitright ssop stmp
swapfile sxq tabstop tal term tf titlelen toolbariconsize ttimeout ttymouse
udir updatetime verbose virtualedit wc wh wildcharm wim winminheight wmh
wrapscan ww
-syn keyword vimOption contained altkeymap arabic autowrite backupcopy
bdir bin bomb bt ccv charconvert cinoptions cms comments conceallevel cpo
cscopequickfix csqf cursorbind define diffexpr dy ef eol esckeys fcs fdn ff
fileignorecase fmr foldlevel foldtext fsync gfs gtl guioptions hf hk hlsearch
imactivatekey imi include inex isi js kp linebreak lm lz matchpairs maxmemtot
mkspellmem mod mousef mouset nf oft pa path pheader previewheight
printmbcharset pvw regexpengine rightleft rtp sbo scrolljump sel shell
shelltype shortname shq sm so spellfile spr st sts swapsync syn tag tb termbidi
tgst titleold top ttimeoutlen ttyscroll ul ur verbosefile visualbell
+syn keyword vimOption contained altkeymap arabic autowrite backupcopy
bdir bin bomb bt ccv charconvert cinoptions cms comments conceallevel cpo
cscopequickfix csqf cursorbind define diffexpr dy ef eol esckeys fcs fdn ff
fileignorecase fmr foldlevel foldtext fsync gfs gtl guioptions hf hk hlsearch
imactivatekey imi include inex isi js kp linebreak lm lz matchpairs maxmemtot
mkspellmem mod mousef mouset nf oft pa path pheader previewheight
printmbcharset pvw regexpengine rightleft rtp sbo scrolljump sel shell
shelltype shortname shq sm so spellfile spr st sts swapsync syn tag tb termbidi
tgst titleold top ttimeoutlen ttyscroll ul ur verbosefile visualbell guicolors
" vimOptions: These are the turn-off setting variants {{{2
syn keyword vimOption contained noacd noallowrevins noantialias
noarabic noarshape noautoread noaw noballooneval nobinary nobk nobuflisted
nocin noconfirm nocopyindent nocscoperelative nocsre nocuc nocursorcolumn
nodelcombine nodigraph noed noendofline noerrorbells noex nofen nofk nogd nohid
nohkmap nohkp nohlsearch noicon noim noimcmdline noimdisable noinf noinsertmode
nojoinspaces nolazyredraw nolinebreak nolist nolpl noma nomagic noml nomodeline
nomodified nomousef nomousehide nonumber noopendevice nopi nopreviewwindow
nopvw norelativenumber norestorescreen nori norl noro noru nosb noscb noscs
nosft noshelltemp noshortname noshowfulltag noshowmode nosm nosmartindent nosmd
nosol nosplitbelow nospr nossl nostartofline noswapfile nota notagrelative
notbi notbs noterse notextmode notgst notimeout noto notr nottybuiltin notx
noundofile novisualbell nowarn noweirdinvert nowfw nowildignorecase
nowinfixheight nowiv nowrap nowrite nowritebackup
syn keyword vimOption contained noai noaltkeymap noar noarabicshape
noautochdir noautowrite noawa nobeval nobiosk nobl nocf nocindent noconsk nocp
nocscopetag nocst nocul nocursorline nodg noea noedcompatible noeol noesckeys
noexpandtab nofic nofkmap nogdefault nohidden nohkmapp nohls noic noignorecase
noimc noimd noincsearch noinfercase nois nojs nolbr nolisp noloadplugins nolz
nomacatsui nomh nomod nomodifiable nomore nomousefocus nonu noodev nopaste
nopreserveindent noprompt noreadonly noremap norevins norightleft nornu nors
noruler nosc noscrollbind nosecure noshellslash noshiftround noshowcmd
noshowmatch nosi nosmartcase nosmarttab nosn nospell nosplitright nosr nosta
nostmp noswf notagbsearch notagstack notbidi notermbidi notextauto notf
notildeop notitle notop nottimeout nottyfast noudf novb nowa nowb nowfh nowic
nowildmenu nowinfixwidth nowmnu nowrapscan nowriteany nows
-syn keyword vimOption contained noakm noanti noarab noari noautoindent
noautowriteall nobackup nobin nobioskey nobomb noci nocompatible noconskey
nocrb nocscopeverbose nocsverb nocursorbind nodeco nodiff noeb noek
noequalalways noet noexrc nofileignorecase nofoldenable noguipty nohk
+syn keyword vimOption contained noakm noanti noarab noari noautoindent
noautowriteall nobackup nobin nobioskey nobomb noci nocompatible noconskey
nocrb nocscopeverbose nocsverb nocursorbind nodeco nodiff noeb noek
noequalalways noet noexrc nofileignorecase nofoldenable noguipty nohk
noguicolors
" vimOptions: These are the invertible variants {{{2
syn keyword vimOption contained invacd invallowrevins invantialias
invarabic invarshape invautoread invaw invballooneval invbinary invbk
invbuflisted invcin invconfirm invcopyindent invcscoperelative invcsre invcuc
invcursorcolumn invdelcombine invdigraph inved invendofline inverrorbells invex
invfen invfk invgd invhid invhkmap invhkp invhlsearch invicon invim
invimcmdline invimdisable invinf invinsertmode invjoinspaces invlazyredraw
invlinebreak invlist invlpl invma invmagic invml invmodeline invmodified
invmousef invmousehide invnumber invopendevice invpi invpreviewwindow invpvw
invrelativenumber invrestorescreen invri invrl invro invru invsb invscb invscs
invsft invshelltemp invshortname invshowfulltag invshowmode invsm
invsmartindent invsmd invsol invsplitbelow invspr invssl invstartofline
invswapfile invta invtagrelative invtbi invtbs invterse invtextmode invtgst
invtimeout invto invtr invttybuiltin invtx invundofile invvisualbell invwarn
invweirdinvert invwfw invwildignorecase invwinfixheight invwiv invwrap invwrite
invwritebackup
syn keyword vimOption contained invai invaltkeymap invar invarabicshape
invautochdir invautowrite invawa invbeval invbiosk invbl invcf invcindent
invconsk invcp invcscopetag invcst invcul invcursorline invdg invea
invedcompatible inveol invesckeys invexpandtab invfic invfkmap invgdefault
invhidden invhkmapp invhls invic invignorecase invimc invimd invincsearch
invinfercase invis invjs invlbr invlisp invloadplugins invlz invmacatsui invmh
invmod invmodifiable invmore invmousefocus invnu invodev invpaste
invpreserveindent invprompt invreadonly invremap invrevins invrightleft invrnu
invrs invruler invsc invscrollbind invsecure invshellslash invshiftround
invshowcmd invshowmatch invsi invsmartcase invsmarttab invsn invspell
invsplitright invsr invsta invstmp invswf invtagbsearch invtagstack invtbidi
invtermbidi invtextauto invtf invtildeop invtitle invtop invttimeout invttyfast
invudf invvb invwa invwb invwfh invwic invwildmenu invwinfixwidth invwmnu
invwrapscan invwriteany invws
-syn keyword vimOption contained invakm invanti invarab invari
invautoindent invautowriteall invbackup invbin invbioskey invbomb invci
invcompatible invconskey invcrb invcscopeverbose invcsverb invcursorbind
invdeco invdiff inveb invek invequalalways invet invexrc invfileignorecase
invfoldenable invguipty invhk
+syn keyword vimOption contained invakm invanti invarab invari
invautoindent invautowriteall invbackup invbin invbioskey invbomb invci
invcompatible invconskey invcrb invcscopeverbose invcsverb invcursorbind
invdeco invdiff inveb invek invequalalways invet invexrc invfileignorecase
invfoldenable invguipty invhk invguicolors
" termcap codes (which can also be set) {{{2
syn keyword vimOption contained t_AB t_al t_bc t_ce t_cl t_Co t_Cs t_CS
t_CV t_da t_db t_dl t_DL t_EI t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_fs
t_IE t_IS t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8
t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_ke t_KE t_KF t_KG t_kh
t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ks t_ku t_le t_mb t_md t_me
t_mr t_ms t_nd t_op t_RI t_RV t_Sb t_se t_Sf t_SI t_so t_sr t_te t_ti t_ts t_u7
t_ue t_us t_ut t_vb t_ve t_vi t_vs t_WP t_WS t_xs t_ZH t_ZR
-syn keyword vimOption contained t_AF t_AL t_cd t_Ce t_cm t_cs
+syn keyword vimOption contained t_AF t_AL t_cd t_Ce t_cm t_cs t_8f t_8b
syn match vimOption contained "t_%1"
syn match vimOption contained "t_#2"
syn match vimOption contained "t_#4"
diff -r 03a813f2cf51 -r 64d20b6d9488 src/auto/configure
--- a/src/auto/configure Thu Nov 20 23:07:05 2014 +0100
+++ b/src/auto/configure Sat Nov 22 18:38:22 2014 +0300
@@ -804,6 +804,7 @@
enable_rubyinterp
with_ruby_command
enable_cscope
+enable_termtruecolor
enable_workshop
enable_netbeans
enable_sniff
@@ -1467,6 +1468,7 @@
--enable-tclinterp Include Tcl interpreter.
--enable-rubyinterp=OPTS Include Ruby interpreter. default=no
OPTS=no/yes/dynamic
--enable-cscope Include cscope interface.
+ --enable-termtruecolor Include support for 24-bit colors in ISO-8613-3
compatible terminals
--enable-workshop Include Sun Visual Workshop support.
--disable-netbeans Disable NetBeans integration support.
--enable-sniff Include Sniff interface.
@@ -7087,6 +7089,22 @@
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-termtruecolor
argument" >&5
+$as_echo_n "checking --enable-termtruecolor argument... " >&6; }
+# Check whether --enable-termtruecolor was given.
+if test "${enable_termtruecolor+set}" = set; then :
+ enableval=$enable_termtruecolor;
+else
+ enable_termtruecolor="no"
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_termtruecolor" >&5
+$as_echo "$enable_termtruecolor" >&6; }
+if test "$enable_termtruecolor" = "yes"; then
+ $as_echo "#define FEAT_TERMTRUECOLOR 1" >>confdefs.h
+
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-workshop argument"
>&5
$as_echo_n "checking --enable-workshop argument... " >&6; }
# Check whether --enable-workshop was given.
@@ -11447,7 +11465,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -11493,7 +11511,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -11517,7 +11535,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -11562,7 +11580,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -11586,7 +11604,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
diff -r 03a813f2cf51 -r 64d20b6d9488 src/config.h.in
--- a/src/config.h.in Thu Nov 20 23:07:05 2014 +0100
+++ b/src/config.h.in Sat Nov 22 18:38:22 2014 +0300
@@ -360,6 +360,9 @@
/* Define if you want to include the Tcl interpreter. */
#undef FEAT_TCL
+/* Define if you want 24-bit colors in ISO-8613-3 compatible terminals. */
+#undef FEAT_TERMTRUECOLOR
+
/* Define if you want to include the Sniff interface. */
#undef FEAT_SNIFF
diff -r 03a813f2cf51 -r 64d20b6d9488 src/configure.in
--- a/src/configure.in Thu Nov 20 23:07:05 2014 +0100
+++ b/src/configure.in Sat Nov 22 18:38:22 2014 +0300
@@ -1818,6 +1818,15 @@
AC_DEFINE(FEAT_CSCOPE)
fi
+AC_MSG_CHECKING(--enable-termtruecolor argument)
+AC_ARG_ENABLE(termtruecolor,
+ [ --enable-termtruecolor Include support for 24-bit colors in
ISO-8613-3 compatible terminals], ,
+ [enable_termtruecolor="no"])
+AC_MSG_RESULT($enable_termtruecolor)
+if test "$enable_termtruecolor" = "yes"; then
+ AC_DEFINE(FEAT_TERMTRUECOLOR)
+fi
+
AC_MSG_CHECKING(--enable-workshop argument)
AC_ARG_ENABLE(workshop,
[ --enable-workshop Include Sun Visual Workshop support.], ,
diff -r 03a813f2cf51 -r 64d20b6d9488 src/eval.c
--- a/src/eval.c Thu Nov 20 23:07:05 2014 +0100
+++ b/src/eval.c Sat Nov 22 18:38:22 2014 +0300
@@ -12783,6 +12783,9 @@
#ifdef FEAT_TERMRESPONSE
"termresponse",
#endif
+#ifdef FEAT_TERMTRUECOLOR
+ "termtruecolor",
+#endif
#ifdef FEAT_TEXTOBJ
"textobjects",
#endif
diff -r 03a813f2cf51 -r 64d20b6d9488 src/globals.h
--- a/src/globals.h Thu Nov 20 23:07:05 2014 +0100
+++ b/src/globals.h Sat Nov 22 18:38:22 2014 +0300
@@ -368,6 +368,10 @@
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
+EXTERN long_u cterm_normal_fg_gui_color INIT(= INVALCOLOR);
+EXTERN long_u cterm_normal_bg_gui_color INIT(= INVALCOLOR);
+#endif
#ifdef FEAT_AUTOCMD
EXTERN int autocmd_busy INIT(= FALSE); /* Is apply_autocmds() busy? */
diff -r 03a813f2cf51 -r 64d20b6d9488 src/hardcopy.c
--- a/src/hardcopy.c Thu Nov 20 23:07:05 2014 +0100
+++ b/src/hardcopy.c Sat Nov 22 18:38:22 2014 +0300
@@ -284,8 +284,8 @@
pattr->underline = (highlight_has_attr(hl_id, HL_UNDERLINE, modec) !=
NULL);
pattr->undercurl = (highlight_has_attr(hl_id, HL_UNDERCURL, modec) !=
NULL);
-# ifdef FEAT_GUI
- if (gui.in_use)
+# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
+ if (USE_24BIT)
{
bg_color = highlight_gui_color_rgb(hl_id, FALSE);
if (bg_color == PRCOLOR_BLACK)
diff -r 03a813f2cf51 -r 64d20b6d9488 src/option.c
--- a/src/option.c Thu Nov 20 23:07:05 2014 +0100
+++ b/src/option.c Sat Nov 22 18:38:22 2014 +0300
@@ -1296,6 +1296,15 @@
{(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_COMMA|P_NODUP,
#ifdef CURSOR_SHAPE
(char_u *)&p_guicursor, PV_NONE,
@@ -2981,6 +2990,8 @@
p_term("t_xs", T_XS)
p_term("t_ZH", T_CZH)
p_term("t_ZR", T_CZR)
+ p_term("t_8f", T_8F)
+ p_term("t_8b", T_8B)
/* terminal key codes are not in here */
@@ -8203,6 +8214,17 @@
#endif
+#ifdef FEAT_TERMTRUECOLOR
+ /* 'guicolors' */
+ else if ((int *)varp == &p_guicolors)
+ {
+# ifdef FEAT_GUI
+ if (!gui.in_use && !gui.starting)
+# endif
+ highlight_gui_started();
+ }
+#endif
+
/*
* End of handling side effects for bool options.
*/
diff -r 03a813f2cf51 -r 64d20b6d9488 src/option.h
--- a/src/option.h Thu Nov 20 23:07:05 2014 +0100
+++ b/src/option.h Sat Nov 22 18:38:22 2014 +0300
@@ -497,6 +497,9 @@
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
diff -r 03a813f2cf51 -r 64d20b6d9488 src/proto/term.pro
--- a/src/proto/term.pro Thu Nov 20 23:07:05 2014 +0100
+++ b/src/proto/term.pro Sat Nov 22 18:38:22 2014 +0300
@@ -59,4 +59,9 @@
int show_one_termcode __ARGS((char_u *name, char_u *code, int printit));
char_u *translate_mapping __ARGS((char_u *str, int expmap));
void update_tcap __ARGS((int attr));
+guicolor_T termtrue_mch_get_color __ARGS((char_u *name));
+guicolor_T termtrue_get_color __ARGS((char_u *name));
+long_u termtrue_mch_get_rgb __ARGS((guicolor_T color));
+void term_fg_rgb_color __ARGS((long_u rgb));
+void term_bg_rgb_color __ARGS((long_u rgb));
/* vim: set ft=c : */
diff -r 03a813f2cf51 -r 64d20b6d9488 src/screen.c
--- a/src/screen.c Thu Nov 20 23:07:05 2014 +0100
+++ b/src/screen.c Sat Nov 22 18:38:22 2014 +0300
@@ -7716,7 +7716,7 @@
{
if (attr > HL_ALL) /* special HL attr. */
{
- if (t_colors > 1)
+ if (IS_CTERM)
aep = syn_cterm_attr2entry(attr);
else
aep = syn_term_attr2entry(attr);
@@ -7727,8 +7727,16 @@
}
if ((attr & HL_BOLD) && T_MD != NULL) /* bold */
out_str(T_MD);
- else if (aep != NULL && t_colors > 1 && aep->ae_u.cterm.fg_color
- && cterm_normal_fg_bold)
+ else if (aep != NULL && cterm_normal_fg_bold &&
+#ifdef FEAT_TERMTRUECOLOR
+ (p_guicolors ?
+ (aep->ae_u.cterm.fg_rgb != INVALCOLOR):
+#endif
+ (t_colors > 1 && aep->ae_u.cterm.fg_color)
+#ifdef FEAT_TERMTRUECOLOR
+ )
+#endif
+ )
/* If the Normal FG color has BOLD attribute and the new HL
* has a FG color defined, clear BOLD. */
out_str(T_ME);
@@ -7748,17 +7756,29 @@
*/
if (aep != NULL)
{
- if (t_colors > 1)
- {
- if (aep->ae_u.cterm.fg_color)
- term_fg_color(aep->ae_u.cterm.fg_color - 1);
- if (aep->ae_u.cterm.bg_color)
- term_bg_color(aep->ae_u.cterm.bg_color - 1);
+#ifdef FEAT_TERMTRUECOLOR
+ if (p_guicolors)
+ {
+ if (aep->ae_u.cterm.fg_rgb != INVALCOLOR)
+ term_fg_rgb_color(aep->ae_u.cterm.fg_rgb);
+ if (aep->ae_u.cterm.bg_rgb != INVALCOLOR)
+ term_bg_rgb_color(aep->ae_u.cterm.bg_rgb);
}
else
- {
- if (aep->ae_u.term.start != NULL)
- out_str(aep->ae_u.term.start);
+#endif
+ {
+ if (t_colors > 1)
+ {
+ if (aep->ae_u.cterm.fg_color)
+ term_fg_color(aep->ae_u.cterm.fg_color - 1);
+ if (aep->ae_u.cterm.bg_color)
+ term_bg_color(aep->ae_u.cterm.bg_color - 1);
+ }
+ else
+ {
+ if (aep->ae_u.term.start != NULL)
+ out_str(aep->ae_u.term.start);
+ }
}
}
}
@@ -7792,14 +7812,23 @@
{
attrentry_T *aep;
- if (t_colors > 1)
+ if (IS_CTERM)
{
/*
* Assume that t_me restores the original colors!
*/
aep = syn_cterm_attr2entry(screen_attr);
- if (aep != NULL && (aep->ae_u.cterm.fg_color
- || aep->ae_u.cterm.bg_color))
+ if (aep != NULL &&
+#ifdef FEAT_TERMTRUECOLOR
+ (p_guicolors ?
+ (aep->ae_u.cterm.fg_rgb != INVALCOLOR ||
+ aep->ae_u.cterm.bg_rgb != INVALCOLOR):
+#endif
+ (aep->ae_u.cterm.fg_color ||
aep->ae_u.cterm.bg_color)
+#ifdef FEAT_TERMTRUECOLOR
+ )
+#endif
+ )
do_ME = TRUE;
}
else
@@ -7847,15 +7876,27 @@
if (do_ME || (screen_attr & (HL_BOLD | HL_INVERSE)))
out_str(T_ME);
- if (t_colors > 1)
- {
- /* set Normal cterm colors */
- if (cterm_normal_fg_color != 0)
- term_fg_color(cterm_normal_fg_color - 1);
- if (cterm_normal_bg_color != 0)
- term_bg_color(cterm_normal_bg_color - 1);
- if (cterm_normal_fg_bold)
- out_str(T_MD);
+#ifdef FEAT_TERMTRUECOLOR
+ if (p_guicolors)
+ {
+ if (cterm_normal_fg_gui_color != INVALCOLOR)
+ term_fg_rgb_color(cterm_normal_fg_gui_color);
+ if (cterm_normal_bg_gui_color != INVALCOLOR)
+ term_bg_rgb_color(cterm_normal_bg_gui_color);
+ }
+ else
+#endif
+ {
+ if (t_colors > 1)
+ {
+ /* set Normal cterm colors */
+ if (cterm_normal_fg_color != 0)
+ term_fg_color(cterm_normal_fg_color - 1);
+ if (cterm_normal_bg_color != 0)
+ term_bg_color(cterm_normal_bg_color - 1);
+ if (cterm_normal_fg_bold)
+ out_str(T_MD);
+ }
}
}
}
@@ -7869,10 +7910,17 @@
void
reset_cterm_colors()
{
- if (t_colors > 1)
+ if (IS_CTERM)
{
/* set Normal cterm colors */
+#ifdef FEAT_TERMTRUECOLOR
+ if (p_guicolors ?
+ (cterm_normal_fg_gui_color != INVALCOLOR
+ || cterm_normal_bg_gui_color != INVALCOLOR):
+ (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0))
+#else
if (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0)
+#endif
{
out_str(T_OP);
screen_attr = -1;
@@ -8118,7 +8166,7 @@
#ifdef FEAT_GUI
!gui.in_use &&
#endif
- t_colors <= 1);
+ !IS_CTERM);
for (row = start_row; row < end_row; ++row)
{
#ifdef FEAT_MBYTE
@@ -8812,6 +8860,9 @@
#ifdef FEAT_GUI
|| gui.in_use
#endif
+#ifdef FEAT_TERMTRUECOLOR
+ || (p_guicolors && cterm_normal_bg_gui_color != INVALCOLOR)
+#endif
|| cterm_normal_bg_color == 0 || *T_UT != NUL));
}
@@ -10122,6 +10173,9 @@
#ifdef FEAT_GUI
&& !gui.in_use
#endif
+#ifdef FEAT_TERMTRUECOLOR
+ && !p_guicolors
+#endif
);
redraw_tabline = FALSE;
diff -r 03a813f2cf51 -r 64d20b6d9488 src/structs.h
--- a/src/structs.h Thu Nov 20 23:07:05 2014 +0100
+++ b/src/structs.h Sat Nov 22 18:38:22 2014 +0300
@@ -84,7 +84,9 @@
# ifdef FEAT_XCLIPBOARD
# include <X11/Intrinsic.h>
# endif
-# define guicolor_T int /* avoid error in prototypes */
+# define guicolor_T long_u /* avoid error in prototypes and
+ * make FEAT_TERMTRUECOLOR work */
+# define INVALCOLOR ((guicolor_T)0x1ffffff)
#endif
/*
@@ -911,6 +913,10 @@
/* 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
+ long_u fg_rgb; /* foreground color RGB */
+ long_u bg_rgb; /* background color RGB */
+# endif
} cterm;
# ifdef FEAT_GUI
struct
diff -r 03a813f2cf51 -r 64d20b6d9488 src/syntax.c
--- a/src/syntax.c Thu Nov 20 23:07:05 2014 +0100
+++ b/src/syntax.c Sat Nov 22 18:38:22 2014 +0300
@@ -33,10 +33,12 @@
int sg_cterm_fg; /* terminal fg color number + 1 */
int sg_cterm_bg; /* terminal bg color number + 1 */
int sg_cterm_attr; /* Screen attr for color term mode */
-#ifdef FEAT_GUI
/* for when using the GUI */
+#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
guicolor_T sg_gui_fg; /* GUI foreground color handle */
guicolor_T sg_gui_bg; /* GUI background color handle */
+#endif
+#ifdef FEAT_GUI
guicolor_T sg_gui_sp; /* GUI special color handle */
GuiFont sg_font; /* GUI font handle */
#ifdef FEAT_XFONTSET
@@ -97,10 +99,12 @@
static int hl_has_settings __ARGS((int idx, int check_link));
static void highlight_clear __ARGS((int idx));
+#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
+static void gui_do_one_color __ARGS((int idx, int do_menu, int do_tooltip));
+static guicolor_T color_name2handle __ARGS((char_u *name));
+#endif
#ifdef FEAT_GUI
-static void gui_do_one_color __ARGS((int idx, int do_menu, int do_tooltip));
static int set_group_colors __ARGS((char_u *name, guicolor_T *fgp, guicolor_T
*bgp, int do_menu, int use_norm, int do_tooltip));
-static guicolor_T color_name2handle __ARGS((char_u *name));
static GuiFont font_name2handle __ARGS((char_u *name));
# ifdef FEAT_XFONTSET
static GuiFontset fontset_name2handle __ARGS((char_u *name, int fixed_width));
@@ -7302,8 +7306,8 @@
for (idx = 0; idx < highlight_ga.ga_len; ++idx)
highlight_clear(idx);
init_highlight(TRUE, TRUE);
-#ifdef FEAT_GUI
- if (gui.in_use)
+#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
+ if (USE_24BIT)
highlight_gui_started();
#endif
highlight_changed();
@@ -7760,10 +7764,16 @@
if (!init)
HL_TABLE()[idx].sg_set |= SG_GUI;
-# ifdef FEAT_GUI
+# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
/* In GUI guifg colors are only used when recognized */
i = color_name2handle(arg);
- if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !gui.in_use)
+ if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0
+# ifdef FEAT_GUI
+ || !(USE_24BIT)
+# else
+ || !p_guicolors
+# endif
+ )
{
HL_TABLE()[idx].sg_gui_fg = i;
# endif
@@ -7772,7 +7782,7 @@
HL_TABLE()[idx].sg_gui_fg_name = vim_strsave(arg);
else
HL_TABLE()[idx].sg_gui_fg_name = NULL;
-# ifdef FEAT_GUI
+# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
# ifdef FEAT_GUI_X11
if (is_menu_group)
gui.menu_fg_pixel = i;
@@ -7797,10 +7807,10 @@
if (!init)
HL_TABLE()[idx].sg_set |= SG_GUI;
-# ifdef FEAT_GUI
+# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
/* In GUI guifg colors are only used when recognized */
i = color_name2handle(arg);
- if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !gui.in_use)
+ if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT)
{
HL_TABLE()[idx].sg_gui_bg = i;
# endif
@@ -7809,7 +7819,7 @@
HL_TABLE()[idx].sg_gui_bg_name = vim_strsave(arg);
else
HL_TABLE()[idx].sg_gui_bg_name = NULL;
-# ifdef FEAT_GUI
+# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
# ifdef FEAT_GUI_X11
if (is_menu_group)
gui.menu_bg_pixel = i;
@@ -7969,7 +7979,9 @@
* Need to update all groups, because they might be using "bg"
* and/or "fg", which have been changed now.
*/
- if (gui.in_use)
+#endif
+#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
+ if (USE_24BIT)
highlight_gui_started();
#endif
}
@@ -8040,6 +8052,10 @@
cterm_normal_fg_color = 0;
cterm_normal_fg_bold = 0;
cterm_normal_bg_color = 0;
+# ifdef FEAT_TERMTRUECOLOR
+ cterm_normal_fg_gui_color = INVALCOLOR;
+ cterm_normal_bg_gui_color = INVALCOLOR;
+# endif
#endif
}
@@ -8093,9 +8109,11 @@
vim_free(HL_TABLE()[idx].sg_gui_sp_name);
HL_TABLE()[idx].sg_gui_sp_name = NULL;
#endif
-#ifdef FEAT_GUI
+#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
HL_TABLE()[idx].sg_gui_fg = INVALCOLOR;
HL_TABLE()[idx].sg_gui_bg = INVALCOLOR;
+#endif
+#ifdef FEAT_GUI
HL_TABLE()[idx].sg_gui_sp = INVALCOLOR;
gui_mch_free_font(HL_TABLE()[idx].sg_font);
HL_TABLE()[idx].sg_font = NOFONT;
@@ -8115,7 +8133,7 @@
#endif
}
-#if defined(FEAT_GUI) || defined(PROTO)
+#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) || defined(PROTO)
/*
* Set the normal foreground and background colors according to the "Normal"
* highlighting group. For X11 also set "Menu", "Scrollbar", and
@@ -8124,44 +8142,78 @@
void
set_normal_colors()
{
- if (set_group_colors((char_u *)"Normal",
- &gui.norm_pixel, &gui.back_pixel,
- FALSE, TRUE, FALSE))
- {
- gui_mch_new_colors();
- must_redraw = CLEAR;
- }
-#ifdef FEAT_GUI_X11
- if (set_group_colors((char_u *)"Menu",
- &gui.menu_fg_pixel, &gui.menu_bg_pixel,
- TRUE, FALSE, FALSE))
- {
-# ifdef FEAT_MENU
- gui_mch_new_menu_colors();
+#ifdef FEAT_GUI
+# ifdef FEAT_TERMTRUECOLOR
+ if (gui.in_use)
# endif
- must_redraw = CLEAR;
- }
-# ifdef FEAT_BEVAL
- if (set_group_colors((char_u *)"Tooltip",
- &gui.tooltip_fg_pixel, &gui.tooltip_bg_pixel,
- FALSE, FALSE, TRUE))
- {
-# ifdef FEAT_TOOLBAR
- gui_mch_new_tooltip_colors();
+ {
+ if (set_group_colors((char_u *)"Normal",
+ &gui.norm_pixel, &gui.back_pixel,
+ FALSE, TRUE, FALSE))
+ {
+ gui_mch_new_colors();
+ must_redraw = CLEAR;
+ }
+# ifdef FEAT_GUI_X11
+ if (set_group_colors((char_u *)"Menu",
+ &gui.menu_fg_pixel, &gui.menu_bg_pixel,
+ TRUE, FALSE, FALSE))
+ {
+# ifdef FEAT_MENU
+ gui_mch_new_menu_colors();
+# endif
+ must_redraw = CLEAR;
+ }
+# ifdef FEAT_BEVAL
+ if (set_group_colors((char_u *)"Tooltip",
+ &gui.tooltip_fg_pixel, &gui.tooltip_bg_pixel,
+ FALSE, FALSE, TRUE))
+ {
+# ifdef FEAT_TOOLBAR
+ gui_mch_new_tooltip_colors();
+# endif
+ must_redraw = CLEAR;
+ }
+# endif
+ if (set_group_colors((char_u *)"Scrollbar",
+ &gui.scroll_fg_pixel, &gui.scroll_bg_pixel,
+ FALSE, FALSE, FALSE))
+ {
+ gui_new_scrollbar_colors();
+ must_redraw = CLEAR;
+ }
# endif
- must_redraw = CLEAR;
- }
-#endif
- if (set_group_colors((char_u *)"Scrollbar",
- &gui.scroll_fg_pixel, &gui.scroll_bg_pixel,
- FALSE, FALSE, FALSE))
- {
- gui_new_scrollbar_colors();
- must_redraw = CLEAR;
- }
-#endif
-}
-
+ }
+#endif
+#ifdef FEAT_TERMTRUECOLOR
+# ifdef FEAT_GUI
+ else
+# endif
+ {
+ int idx;
+
+ idx = syn_name2id((char_u *)"Normal") - 1;
+ if (idx >= 0)
+ {
+ gui_do_one_color(idx, FALSE, FALSE);
+
+ if (HL_TABLE()[idx].sg_gui_fg != INVALCOLOR)
+ {
+ cterm_normal_fg_gui_color = HL_TABLE()[idx].sg_gui_fg;
+ must_redraw = CLEAR;
+ }
+ if (HL_TABLE()[idx].sg_gui_bg != INVALCOLOR)
+ {
+ cterm_normal_bg_gui_color = HL_TABLE()[idx].sg_gui_bg;
+ must_redraw = CLEAR;
+ }
+ }
+ }
+#endif
+}
+#endif
+
+#if defined(FEAT_GUI) || defined(PROTO)
/*
* Set the colors for "Normal", "Menu", "Tooltip" or "Scrollbar".
*/
@@ -8275,25 +8327,6 @@
}
/*
- * Return the handle for a color name.
- * Returns INVALCOLOR when failed.
- */
- static guicolor_T
-color_name2handle(name)
- char_u *name;
-{
- if (STRCMP(name, "NONE") == 0)
- return INVALCOLOR;
-
- if (STRICMP(name, "fg") == 0 || STRICMP(name, "foreground") == 0)
- return gui.norm_pixel;
- if (STRICMP(name, "bg") == 0 || STRICMP(name, "background") == 0)
- return gui.back_pixel;
-
- return gui_get_color(name);
-}
-
-/*
* Return the handle for a font name.
* Returns NOFONT when failed.
*/
@@ -8419,6 +8452,53 @@
#endif /* FEAT_GUI */
+#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) || defined(PROTO)
+/*
+ * Return the handle for a color name.
+ * Returns INVALCOLOR when failed.
+ */
+ static guicolor_T
+color_name2handle(name)
+ char_u *name;
+{
+ if (STRCMP(name, "NONE") == 0)
+ return INVALCOLOR;
+
+ if (STRICMP(name, "fg") == 0 || STRICMP(name, "foreground") == 0)
+ {
+#if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI)
+ if (gui.in_use)
+#endif
+#ifdef FEAT_GUI
+ return gui.norm_pixel;
+#endif
+#if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI)
+ else
+#endif
+#ifdef FEAT_TERMTRUECOLOR
+ return cterm_normal_fg_gui_color;
+#endif
+ }
+ if (STRICMP(name, "bg") == 0 || STRICMP(name, "background") == 0)
+ {
+#if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI)
+ if (gui.in_use)
+#endif
+#ifdef FEAT_GUI
+ return gui.back_pixel;
+#endif
+#if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI)
+ else
+#endif
+#ifdef FEAT_TERMTRUECOLOR
+ return cterm_normal_bg_gui_color;
+#endif
+ }
+
+ return GUI_GET_COLOR(name);
+}
+#endif
+
/*
* Table with the specifications for an attribute number.
* Note that this table is used by ALL buffers. This is required because the
@@ -8496,8 +8576,15 @@
&& aep->ae_u.cterm.fg_color
== taep->ae_u.cterm.fg_color
&& aep->ae_u.cterm.bg_color
- == taep->ae_u.cterm.bg_color)
- ))
+ == taep->ae_u.cterm.bg_color
+#ifdef FEAT_TERMTRUECOLOR
+ && aep->ae_u.cterm.fg_rgb
+ == taep->ae_u.cterm.fg_rgb
+ && aep->ae_u.cterm.bg_rgb
+ == taep->ae_u.cterm.bg_rgb
+#endif
+
+ )))
return i + ATTR_OFF;
}
@@ -8562,6 +8649,10 @@
{
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
+ 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
}
++table->ga_len;
return (table->ga_len - 1 + ATTR_OFF);
@@ -8655,7 +8746,7 @@
}
#endif
- if (t_colors > 1)
+ if (IS_CTERM)
{
if (char_attr > HL_ALL)
char_aep = syn_cterm_attr2entry(char_attr);
@@ -8680,6 +8771,12 @@
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
+ if (spell_aep->ae_u.cterm.fg_rgb != INVALCOLOR)
+ new_en.ae_u.cterm.fg_rgb = spell_aep->ae_u.cterm.fg_rgb;
+ if (spell_aep->ae_u.cterm.bg_rgb != INVALCOLOR)
+ new_en.ae_u.cterm.bg_rgb = spell_aep->ae_u.cterm.bg_rgb;
+#endif
}
}
return get_attr_entry(&cterm_attr_table, &new_en);
@@ -8743,10 +8840,10 @@
aep = syn_gui_attr2entry(attr);
else
#endif
- if (t_colors > 1)
- aep = syn_cterm_attr2entry(attr);
- else
- aep = syn_term_attr2entry(attr);
+ if (IS_CTERM)
+ aep = syn_cterm_attr2entry(attr);
+ else
+ aep = syn_term_attr2entry(attr);
if (aep == NULL) /* highlighting not set */
return 0;
@@ -8948,13 +9045,15 @@
return NULL;
if (modec == 'g')
{
-# ifdef FEAT_GUI
+# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
+# ifdef FEAT_GUI
/* return font name */
if (font)
return HL_TABLE()[id - 1].sg_font_name;
+# endif
/* return #RRGGBB form (only possible when GUI is running) */
- if (gui.in_use && what[2] == '#')
+ if ((USE_24BIT) && what[2] == '#')
{
guicolor_T color;
long_u rgb;
@@ -8963,19 +9062,23 @@
if (fg)
color = HL_TABLE()[id - 1].sg_gui_fg;
else if (sp)
+# ifdef FEAT_GUI
color = HL_TABLE()[id - 1].sg_gui_sp;
+# else
+ color = INVALCOLOR;
+# endif
else
color = HL_TABLE()[id - 1].sg_gui_bg;
if (color == INVALCOLOR)
return NULL;
- rgb = gui_mch_get_rgb(color);
+ rgb = GUI_MCH_GET_RGB(color);
sprintf((char *)buf, "#%02x%02x%02x",
(unsigned)(rgb >> 16),
(unsigned)(rgb >> 8) & 255,
(unsigned)rgb & 255);
return buf;
}
-#endif
+# endif
if (fg)
return (HL_TABLE()[id - 1].sg_gui_fg_name);
if (sp)
@@ -8998,8 +9101,9 @@
}
#endif
-#if (defined(FEAT_SYN_HL) && defined(FEAT_GUI) && defined(FEAT_PRINTER)) \
- || defined(PROTO)
+#if (defined(FEAT_SYN_HL) \
+ && (defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)) \
+ && defined(FEAT_PRINTER)) || defined(PROTO)
/*
* Return color name of highlight group "id" as RGB value.
*/
@@ -9021,7 +9125,7 @@
if (color == INVALCOLOR)
return 0L;
- return gui_mch_get_rgb(color);
+ return GUI_MCH_GET_RGB(color);
}
#endif
@@ -9137,13 +9241,22 @@
* For the color term mode: If there are other than "normal"
* highlighting attributes, need to allocate an attr number.
*/
- if (sgp->sg_cterm_fg == 0 && sgp->sg_cterm_bg == 0)
+ if (sgp->sg_cterm_fg == 0 && sgp->sg_cterm_bg == 0
+# ifdef FEAT_TERMTRUECOLOR
+ && sgp->sg_gui_fg == INVALCOLOR
+ && sgp->sg_gui_bg == INVALCOLOR
+# endif
+ )
sgp->sg_cterm_attr = sgp->sg_cterm;
else
{
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
+ 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
sgp->sg_cterm_attr = get_attr_entry(&cterm_attr_table, &at_en);
}
}
@@ -9302,10 +9415,12 @@
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);
-#ifdef FEAT_GUI
+#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
HL_TABLE()[highlight_ga.ga_len].sg_gui_bg = INVALCOLOR;
HL_TABLE()[highlight_ga.ga_len].sg_gui_fg = INVALCOLOR;
+# ifdef FEAT_GUI
HL_TABLE()[highlight_ga.ga_len].sg_gui_sp = INVALCOLOR;
+# endif
#endif
++highlight_ga.ga_len;
@@ -9345,7 +9460,7 @@
attr = sgp->sg_gui_attr;
else
#endif
- if (t_colors > 1)
+ if (IS_CTERM)
attr = sgp->sg_cterm_attr;
else
attr = sgp->sg_term_attr;
@@ -9403,7 +9518,7 @@
return hl_id;
}
-#ifdef FEAT_GUI
+#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
/*
* Call this function just after the GUI has started.
* It finds the font and color handles for the highlighting groups.
@@ -9414,7 +9529,12 @@
int idx;
/* First get the colors from the "Normal" and "Menu" group, if set */
- set_normal_colors();
+# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
+# ifdef FEAT_TERMTRUECOLOR
+ if (USE_24BIT)
+# endif
+ set_normal_colors();
+# endif
for (idx = 0; idx < highlight_ga.ga_len; ++idx)
gui_do_one_color(idx, FALSE, FALSE);
@@ -9430,12 +9550,17 @@
{
int didit = FALSE;
- if (HL_TABLE()[idx].sg_font_name != NULL)
- {
- hl_do_font(idx, HL_TABLE()[idx].sg_font_name, FALSE, do_menu,
+# ifdef FEAT_GUI
+# ifdef FEAT_TERMTRUECOLOR
+ if (gui.in_use)
+# endif
+ if (HL_TABLE()[idx].sg_font_name != NULL)
+ {
+ hl_do_font(idx, HL_TABLE()[idx].sg_font_name, FALSE, do_menu,
do_tooltip, TRUE);
- didit = TRUE;
- }
+ didit = TRUE;
+ }
+# endif
if (HL_TABLE()[idx].sg_gui_fg_name != NULL)
{
HL_TABLE()[idx].sg_gui_fg =
@@ -9448,16 +9573,17 @@
color_name2handle(HL_TABLE()[idx].sg_gui_bg_name);
didit = TRUE;
}
+# ifdef FEAT_GUI
if (HL_TABLE()[idx].sg_gui_sp_name != NULL)
{
HL_TABLE()[idx].sg_gui_sp =
color_name2handle(HL_TABLE()[idx].sg_gui_sp_name);
didit = TRUE;
}
+# endif
if (didit) /* need to get a new attr number */
set_hl_attr(idx);
}
-
#endif
/*
diff -r 03a813f2cf51 -r 64d20b6d9488 src/term.c
--- a/src/term.c Thu Nov 20 23:07:05 2014 +0100
+++ b/src/term.c Sat Nov 22 18:38:22 2014 +0300
@@ -77,6 +77,9 @@
static struct builtin_term *find_builtin_term __ARGS((char_u *name));
static void parse_builtin_tcap __ARGS((char_u *s));
static void term_color __ARGS((char_u *s, int n));
+#ifdef FEAT_TERMTRUECOLOR
+static void term_rgb_color __ARGS((char_u *s, long_u rgb));
+#endif
static void gather_termleader __ARGS((void));
#ifdef FEAT_TERMRESPONSE
static void req_codes_from_term __ARGS((void));
@@ -376,9 +379,9 @@
# else
{(int)KS_CRI, "\033[%dC"},
# endif
-#if defined(BEOS_DR8)
+# if defined(BEOS_DR8)
{(int)KS_DB, ""}, /* hack! see screen.c */
-#endif
+# endif
{K_UP, "\033[A"},
{K_DOWN, "\033[B"},
@@ -882,8 +885,10 @@
# endif
# endif
+# if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) ||
defined(SOME_BUILTIN_TCAPS) || defined(__EMX__) || defined(FEAT_TERMTRUECOLOR)
+ {(int)KS_NAME, "xterm"},
+# endif
# if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) ||
defined(SOME_BUILTIN_TCAPS) || defined(__EMX__)
- {(int)KS_NAME, "xterm"},
{(int)KS_CE, IF_EB("\033[K", ESC_STR "[K")},
{(int)KS_AL, IF_EB("\033[L", ESC_STR "[L")},
# ifdef TERMINFO
@@ -1030,6 +1035,10 @@
{TERMCAP2KEY('F', 'Q'), IF_EB("\033[57;*~", ESC_STR "[57;*~")}, /* F36 */
{TERMCAP2KEY('F', 'R'), IF_EB("\033[58;*~", ESC_STR "[58;*~")}, /* F37 */
# endif
+# ifdef FEAT_TERMTRUECOLOR
+ {(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")},
+# endif
# if defined(UNIX) || defined(ALL_BUILTIN_TCAPS)
/*
@@ -1346,6 +1355,173 @@
}; /* end of builtin_termcaps */
+#if defined(FEAT_TERMTRUECOLOR) || defined(PROTO)
+# define RGB(r, g, b) ((r<<16) | (g<<8) | (b))
+struct rgbcolor_table_S {
+ char_u *color_name;
+ guicolor_T color;
+};
+static struct rgbcolor_table_S rgb_table[] = {
+ {(char_u *)"black", RGB(0x00, 0x00, 0x00)},
+ {(char_u *)"blue", RGB(0x00, 0x00, 0xD4)},
+ {(char_u *)"brown", RGB(0x80, 0x40, 0x40)},
+ {(char_u *)"cyan", RGB(0x02, 0xAB, 0xEA)},
+ {(char_u *)"darkblue", RGB(0x00, 0x00, 0x80)},
+ {(char_u *)"darkcyan", RGB(0x00, 0x80, 0x80)},
+ {(char_u *)"darkgray", RGB(0x80, 0x80, 0x80)},
+ {(char_u *)"darkgreen", RGB(0x00, 0x80, 0x00)},
+ {(char_u *)"darkgrey", RGB(0x80, 0x80, 0x80)},
+ {(char_u *)"darkmagenta", RGB(0x80, 0x00, 0x80)},
+ {(char_u *)"darkred", RGB(0x80, 0x00, 0x00)},
+ {(char_u *)"darkyellow", RGB(0xBB, 0xBB, 0x00)},
+ {(char_u *)"gray", RGB(0xC0, 0xC0, 0xC0)},
+ {(char_u *)"gray10", RGB(0x1A, 0x1A, 0x1A)},
+ {(char_u *)"gray20", RGB(0x33, 0x33, 0x33)},
+ {(char_u *)"gray30", RGB(0x4D, 0x4D, 0x4D)},
+ {(char_u *)"gray40", RGB(0x66, 0x66, 0x66)},
+ {(char_u *)"gray50", RGB(0x7F, 0x7F, 0x7F)},
+ {(char_u *)"gray60", RGB(0x99, 0x99, 0x99)},
+ {(char_u *)"gray70", RGB(0xB3, 0xB3, 0xB3)},
+ {(char_u *)"gray80", RGB(0xCC, 0xCC, 0xCC)},
+ {(char_u *)"gray90", RGB(0xE5, 0xE5, 0xE5)},
+ {(char_u *)"green", RGB(0x00, 0x64, 0x11)},
+ {(char_u *)"grey", RGB(0xC0, 0xC0, 0xC0)},
+ {(char_u *)"grey10", RGB(0x1A, 0x1A, 0x1A)},
+ {(char_u *)"grey20", RGB(0x33, 0x33, 0x33)},
+ {(char_u *)"grey30", RGB(0x4D, 0x4D, 0x4D)},
+ {(char_u *)"grey40", RGB(0x66, 0x66, 0x66)},
+ {(char_u *)"grey50", RGB(0x7F, 0x7F, 0x7F)},
+ {(char_u *)"grey60", RGB(0x99, 0x99, 0x99)},
+ {(char_u *)"grey70", RGB(0xB3, 0xB3, 0xB3)},
+ {(char_u *)"grey80", RGB(0xCC, 0xCC, 0xCC)},
+ {(char_u *)"grey90", RGB(0xE5, 0xE5, 0xE5)},
+ {(char_u *)"lightblue", RGB(0xA0, 0xA0, 0xFF)},
+ {(char_u *)"lightcyan", RGB(0xA0, 0xFF, 0xFF)},
+ {(char_u *)"lightgray", RGB(0xE0, 0xE0, 0xE0)},
+ {(char_u *)"lightgreen", RGB(0xA0, 0xFF, 0xA0)},
+ {(char_u *)"lightgrey", RGB(0xE0, 0xE0, 0xE0)},
+ {(char_u *)"lightmagenta",RGB(0xF0, 0xA0, 0xF0)},
+ {(char_u *)"lightred", RGB(0xFF, 0xA0, 0xA0)},
+ {(char_u *)"lightyellow", RGB(0xFF, 0xFF, 0xA0)},
+ {(char_u *)"magenta", RGB(0xF2, 0x08, 0x84)},
+ {(char_u *)"orange", RGB(0xFC, 0x80, 0x00)},
+ {(char_u *)"purple", RGB(0xA0, 0x20, 0xF0)},
+ {(char_u *)"red", RGB(0xDD, 0x08, 0x06)},
+ {(char_u *)"seagreen", RGB(0x2E, 0x8B, 0x57)},
+ {(char_u *)"slateblue", RGB(0x6A, 0x5A, 0xCD)},
+ {(char_u *)"violet", RGB(0x8D, 0x38, 0xC9)},
+ {(char_u *)"white", RGB(0xFF, 0xFF, 0xFF)},
+ {(char_u *)"yellow", RGB(0xFC, 0xF3, 0x05)},
+};
+
+ static int
+hex_digit(int c)
+{
+ if (isdigit(c))
+ return c - '0';
+ c = TOLOWER_ASC(c);
+ if (c >= 'a' && c <= 'f')
+ return c - 'a' + 10;
+ return 0x1ffffff;
+}
+
+ guicolor_T
+termtrue_mch_get_color(char_u *name)
+{
+ guicolor_T color;
+ int i;
+
+ if (*name == '#' && strlen((char *) name) == 7)
+ {
+ color = RGB(((hex_digit(name[1])<<4) + hex_digit(name[2])),
+ ((hex_digit(name[3])<<4) + hex_digit(name[4])),
+ ((hex_digit(name[5])<<4) + hex_digit(name[6])));
+ if (color > 0xffffff)
+ return INVALCOLOR;
+ return color;
+ }
+ else
+ {
+ /* Check if the name is one of the colors we know */
+ for (i = 0; i < sizeof(rgb_table) / sizeof(rgb_table[0]); i++)
+ if (STRICMP(name, rgb_table[i].color_name) == 0)
+ return rgb_table[i].color;
+ }
+
+ /*
+ * Last attempt. Look in the file "$VIM/rgb.txt".
+ */
+ {
+#define LINE_LEN 100
+ FILE *fd;
+ char line[LINE_LEN];
+ char_u *fname;
+ int r, g, b;
+
+ fname = expand_env_save((char_u *)"$VIMRUNTIME/rgb.txt");
+ if (fname == NULL)
+ return INVALCOLOR;
+
+ fd = fopen((char *)fname, "rt");
+ vim_free(fname);
+ if (fd == NULL)
+ return INVALCOLOR;
+
+ while (!feof(fd))
+ {
+ int len;
+ int pos;
+ char *color;
+
+ fgets(line, LINE_LEN, fd);
+ len = strlen(line);
+
+ if (len <= 1 || line[len-1] != '\n')
+ continue;
+
+ line[len-1] = '\0';
+
+ i = sscanf(line, "%d %d %d %n", &r, &g, &b, &pos);
+ if (i != 3)
+ continue;
+
+ color = line + pos;
+
+ if (STRICMP(color, name) == 0)
+ {
+ fclose(fd);
+ return (guicolor_T) RGB(r, g, b);
+ }
+ }
+ fclose(fd);
+ }
+
+ return INVALCOLOR;
+}
+
+ guicolor_T
+termtrue_get_color(name)
+ char_u *name;
+{
+ guicolor_T t;
+
+ if (*name == NUL)
+ return INVALCOLOR;
+ t = termtrue_mch_get_color(name);
+
+ if (t == INVALCOLOR)
+ EMSG2(_("E254: Cannot allocate color %s"), name);
+ return t;
+}
+
+ long_u
+termtrue_mch_get_rgb(color)
+ guicolor_T color;
+{
+ return (long_u) color;
+}
+#endif
+
/*
* DEFAULT_TERM is used, when no terminal is specified with -T option or $TERM.
*/
@@ -1612,6 +1788,7 @@
{KS_CWP, "WP"}, {KS_CWS, "WS"},
{KS_CSI, "SI"}, {KS_CEI, "EI"},
{KS_U7, "u7"},
+ {KS_8F, "8f"}, {KS_8B, "8b"},
{(enum SpecialKey)0, NULL}
};
@@ -2758,6 +2935,35 @@
OUT_STR(tgoto((char *)s, 0, n));
}
+#if defined(FEAT_TERMTRUECOLOR) || defined(PROTO)
+ void
+term_fg_rgb_color(rgb)
+ long_u rgb;
+{
+ term_rgb_color(T_8F, rgb);
+}
+
+ void
+term_bg_rgb_color(rgb)
+ long_u rgb;
+{
+ term_rgb_color(T_8B, rgb);
+}
+
+#define RED(rgb) ((rgb>>16)&0xFF)
+#define GREEN(rgb) ((rgb>> 8)&0xFF)
+#define BLUE(rgb) ((rgb )&0xFF)
+ static void
+term_rgb_color(s, rgb)
+ char_u *s;
+ long_u rgb;
+{
+ char buf[7+3*3+2+1+1];
+ sprintf(buf, (char *)s, RED(rgb), GREEN(rgb), BLUE(rgb));
+ OUT_STR(buf);
+}
+#endif
+
#if (defined(FEAT_TITLE) && (defined(UNIX) || defined(OS2) || defined(VMS) ||
defined(MACOS_X))) || defined(PROTO)
/*
* Generic function to set window title, using t_ts and t_fs.
diff -r 03a813f2cf51 -r 64d20b6d9488 src/term.h
--- a/src/term.h Thu Nov 20 23:07:05 2014 +0100
+++ b/src/term.h Sat Nov 22 18:38:22 2014 +0300
@@ -84,10 +84,12 @@
KS_CSV, /* scroll region vertical */
#endif
KS_OP, /* original color pair */
- KS_U7 /* request cursor position */
+ KS_U7, /* request cursor position */
+ KS_8F, /* set foreground color (RGB) */
+ KS_8B /* set background color (RGB) */
};
-#define KS_LAST KS_U7
+#define KS_LAST KS_8B
/*
* the terminal capabilities are stored in this array
@@ -160,6 +162,8 @@
#define T_CRV (term_str(KS_CRV)) /* request version string */
#define T_OP (term_str(KS_OP)) /* original color pair */
#define T_U7 (term_str(KS_U7)) /* request cursor position */
+#define T_8F (term_str(KS_8F)) /* set foreground color (RGB) */
+#define T_8B (term_str(KS_8B)) /* set background color (RGB) */
#define TMODE_COOK 0 /* terminal mode for external cmds and Ex mode */
#define TMODE_SLEEP 1 /* terminal mode for sleeping (cooked but no echo) */
diff -r 03a813f2cf51 -r 64d20b6d9488 src/version.c
--- a/src/version.c Thu Nov 20 23:07:05 2014 +0100
+++ b/src/version.c Sat Nov 22 18:38:22 2014 +0300
@@ -619,6 +619,11 @@
#else
"-termresponse",
#endif
+#ifdef FEAT_TERMTRUECOLOR
+ "+termtruecolor",
+#else
+ "-termtruecolor",
+#endif
#ifdef FEAT_TEXTOBJ
"+textobjects",
#else
diff -r 03a813f2cf51 -r 64d20b6d9488 src/vim.h
--- a/src/vim.h Thu Nov 20 23:07:05 2014 +0100
+++ b/src/vim.h Sat Nov 22 18:38:22 2014 +0300
@@ -1598,6 +1598,31 @@
#define MSG_PUTS_LONG(s) msg_puts_long_attr((char_u *)(s), 0)
#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)
+# 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
+# endif
+#endif
+#ifdef FEAT_TERMTRUECOLOR
+# define IS_CTERM (t_colors > 1 || p_guicolors)
+#else
+# define IS_CTERM (t_colors > 1)
+#endif
+#ifdef GUI_FUNCTION
+# define GUI_MCH_GET_RGB GUI_FUNCTION(mch_get_rgb)
+# define GUI_MCH_GET_COLOR GUI_FUNCTION(mch_get_color)
+# define GUI_GET_COLOR GUI_FUNCTION(get_color)
+#endif
+
/* Prefer using emsg3(), because perror() may send the output to the wrong
* destination and mess up the screen. */
#ifdef HAVE_STRERROR
--
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.
diff -crN vim-guicolors.03a813f2cf51/runtime/doc/options.txt vim-guicolors.64d20b6d9488/runtime/doc/options.txt
*** vim-guicolors.03a813f2cf51/runtime/doc/options.txt 2014-11-22 18:39:13.982656158 +0300
--- vim-guicolors.64d20b6d9488/runtime/doc/options.txt 2014-11-22 18:39:14.092656156 +0300
***************
*** 3401,3406 ****
--- 3401,3418 ----
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
+ terminal (thus using 24-bit color). Requires ISO-8613-3 compatible
+ terminal.
+ If just setting this option does not work (produces 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,
diff -crN vim-guicolors.03a813f2cf51/runtime/doc/term.txt vim-guicolors.64d20b6d9488/runtime/doc/term.txt
*** vim-guicolors.03a813f2cf51/runtime/doc/term.txt 2014-11-22 18:39:14.002656157 +0300
--- vim-guicolors.64d20b6d9488/runtime/doc/term.txt 2014-11-22 18:39:14.092656156 +0300
***************
*** 296,301 ****
--- 296,305 ----
|xterm-8bit| |v:termresponse| |'ttymouse'| |xterm-codes|
t_u7 request cursor position (for xterm) *t_u7* *'t_u7'*
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'*
+ |xterm-true-color|
KEY CODES
Note: Use the <> form if possible
***************
*** 412,417 ****
--- 416,436 ----
Note: This is only done on startup. If the xterm options are changed after
Vim has started, the escape sequences may not be recognized any more.
+ *xterm-true-color*
+ Vim supports using true colors in terminal (taken from |highlight-guifg| and
+ |highlight-guibg|), given that terminal supports this as well. To make this
+ work 'guicolors' option needs to be set. Sometimes setting it is not enough
+ and one may have to set |t_8f| and |t_8b| options explicitly for GUI colors to
+ work. 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 only 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.
+
*xterm-resize*
Window resizing with xterm only works if the allowWindowOps resource is
enabled. On some systems and versions of xterm it's disabled by default
diff -crN vim-guicolors.03a813f2cf51/runtime/doc/various.txt vim-guicolors.64d20b6d9488/runtime/doc/various.txt
*** vim-guicolors.03a813f2cf51/runtime/doc/various.txt 2014-11-22 18:39:13.902656158 +0300
--- vim-guicolors.64d20b6d9488/runtime/doc/various.txt 2014-11-22 18:39:14.012656157 +0300
***************
*** 428,433 ****
--- 428,434 ----
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
N *+textobjects* |text-objects| selection
*+tgetent* non-Unix only: able to use external termcap
N *+title* Setting the window 'title' and 'icon'
diff -crN vim-guicolors.03a813f2cf51/runtime/syntax/vim.vim vim-guicolors.64d20b6d9488/runtime/syntax/vim.vim
*** vim-guicolors.03a813f2cf51/runtime/syntax/vim.vim 2014-11-22 18:39:13.972656158 +0300
--- vim-guicolors.64d20b6d9488/runtime/syntax/vim.vim 2014-11-22 18:39:14.012656157 +0300
***************
*** 33,53 ****
syn keyword vimOption contained al antialias autochdir background balloondelay bexpr bk bs casemap cf cink cmdheight colorcolumn completefunc copyindent cryptmethod cscopeverbose csverb debug dict dir eb enc errorbells expandtab fdl fenc fileencodings fkmap foldenable foldminlines formatprg gdefault gp guifontset helpfile hidden hl ignorecase imcmdline imsf indentexpr is isp keywordprg lazyredraw lispwords ls makeef maxmapdepth mfd mmd modified mousemodel msm numberwidth operatorfunc pastetoggle pexpr pmbfn printexpr pt re restorescreen rnu rulerformat scr sect sft shellredir shiftwidth showmatch siso smc spc spl ss statusline suffixesadd sws tabline tags tbs textmode timeoutlen to tsl ttyfast uc undoreload vdir viewoptions warn wfh wig wildmode winfixwidth wiw wrap writedelay
syn keyword vimOption contained aleph ar autoindent backspace ballooneval bg bkc bsdir cb cfu cinkeys cmdwinheight columns completeopt cot cscopepathcomp cspc cuc deco dictionary directory ed encoding errorfile exrc fdls fencs fileformat flp foldexpr foldnestmax fp gfm grepformat guifontwide helpheight highlight hlg im imd imstatusfunc indentkeys isf isprint km lbr list lsp makeprg maxmem mh mmp more mouses mzq nuw opfunc patchexpr pfn popt printfont pumheight readonly revins ro runtimepath scroll sections sh shellslash shm showmode sj smd spell splitbelow ssl stl sw sxe tabpagemax tagstack tenc textwidth title toolbar tsr ttym udf updatecount ve viminfo wb wfw wildchar wildoptions winheight wm wrapmargin ws
syn keyword vimOption contained allowrevins arab autoread backup balloonexpr bh bl bsk cc ch cino cmp com concealcursor cp cscopeprg csprg cul def diff display edcompatible endofline errorformat fcl fdm fex fileformats fml foldignore foldopen fs gfn grepprg guiheadroom helplang history hls imactivatefunc imdisable inc indk isfname joinspaces kmp lcs listchars lw mat maxmempattern mis mmt mouse mouseshape mzquantum odev osfiletype patchmode ph preserveindent printheader pvh redrawtime ri rs sb scrollbind secure shcf shelltemp shortmess showtabline slm sn spellcapcheck splitright ssop stmp swapfile sxq tabstop tal term tf titlelen toolbariconsize ttimeout ttymouse udir updatetime verbose virtualedit wc wh wildcharm wim winminheight wmh wrapscan ww
! syn keyword vimOption contained altkeymap arabic autowrite backupcopy bdir bin bomb bt ccv charconvert cinoptions cms comments conceallevel cpo cscopequickfix csqf cursorbind define diffexpr dy ef eol esckeys fcs fdn ff fileignorecase fmr foldlevel foldtext fsync gfs gtl guioptions hf hk hlsearch imactivatekey imi include inex isi js kp linebreak lm lz matchpairs maxmemtot mkspellmem mod mousef mouset nf oft pa path pheader previewheight printmbcharset pvw regexpengine rightleft rtp sbo scrolljump sel shell shelltype shortname shq sm so spellfile spr st sts swapsync syn tag tb termbidi tgst titleold top ttimeoutlen ttyscroll ul ur verbosefile visualbell
" vimOptions: These are the turn-off setting variants {{{2
syn keyword vimOption contained noacd noallowrevins noantialias noarabic noarshape noautoread noaw noballooneval nobinary nobk nobuflisted nocin noconfirm nocopyindent nocscoperelative nocsre nocuc nocursorcolumn nodelcombine nodigraph noed noendofline noerrorbells noex nofen nofk nogd nohid nohkmap nohkp nohlsearch noicon noim noimcmdline noimdisable noinf noinsertmode nojoinspaces nolazyredraw nolinebreak nolist nolpl noma nomagic noml nomodeline nomodified nomousef nomousehide nonumber noopendevice nopi nopreviewwindow nopvw norelativenumber norestorescreen nori norl noro noru nosb noscb noscs nosft noshelltemp noshortname noshowfulltag noshowmode nosm nosmartindent nosmd nosol nosplitbelow nospr nossl nostartofline noswapfile nota notagrelative notbi notbs noterse notextmode notgst notimeout noto notr nottybuiltin notx noundofile novisualbell nowarn noweirdinvert nowfw nowildignorecase nowinfixheight nowiv nowrap nowrite nowritebackup
syn keyword vimOption contained noai noaltkeymap noar noarabicshape noautochdir noautowrite noawa nobeval nobiosk nobl nocf nocindent noconsk nocp nocscopetag nocst nocul nocursorline nodg noea noedcompatible noeol noesckeys noexpandtab nofic nofkmap nogdefault nohidden nohkmapp nohls noic noignorecase noimc noimd noincsearch noinfercase nois nojs nolbr nolisp noloadplugins nolz nomacatsui nomh nomod nomodifiable nomore nomousefocus nonu noodev nopaste nopreserveindent noprompt noreadonly noremap norevins norightleft nornu nors noruler nosc noscrollbind nosecure noshellslash noshiftround noshowcmd noshowmatch nosi nosmartcase nosmarttab nosn nospell nosplitright nosr nosta nostmp noswf notagbsearch notagstack notbidi notermbidi notextauto notf notildeop notitle notop nottimeout nottyfast noudf novb nowa nowb nowfh nowic nowildmenu nowinfixwidth nowmnu nowrapscan nowriteany nows
! syn keyword vimOption contained noakm noanti noarab noari noautoindent noautowriteall nobackup nobin nobioskey nobomb noci nocompatible noconskey nocrb nocscopeverbose nocsverb nocursorbind nodeco nodiff noeb noek noequalalways noet noexrc nofileignorecase nofoldenable noguipty nohk
" vimOptions: These are the invertible variants {{{2
syn keyword vimOption contained invacd invallowrevins invantialias invarabic invarshape invautoread invaw invballooneval invbinary invbk invbuflisted invcin invconfirm invcopyindent invcscoperelative invcsre invcuc invcursorcolumn invdelcombine invdigraph inved invendofline inverrorbells invex invfen invfk invgd invhid invhkmap invhkp invhlsearch invicon invim invimcmdline invimdisable invinf invinsertmode invjoinspaces invlazyredraw invlinebreak invlist invlpl invma invmagic invml invmodeline invmodified invmousef invmousehide invnumber invopendevice invpi invpreviewwindow invpvw invrelativenumber invrestorescreen invri invrl invro invru invsb invscb invscs invsft invshelltemp invshortname invshowfulltag invshowmode invsm invsmartindent invsmd invsol invsplitbelow invspr invssl invstartofline invswapfile invta invtagrelative invtbi invtbs invterse invtextmode invtgst invtimeout invto invtr invttybuiltin invtx invundofile invvisualbell invwarn invweirdinvert invwfw invwildignorecase invwinfixheight invwiv invwrap invwrite invwritebackup
syn keyword vimOption contained invai invaltkeymap invar invarabicshape invautochdir invautowrite invawa invbeval invbiosk invbl invcf invcindent invconsk invcp invcscopetag invcst invcul invcursorline invdg invea invedcompatible inveol invesckeys invexpandtab invfic invfkmap invgdefault invhidden invhkmapp invhls invic invignorecase invimc invimd invincsearch invinfercase invis invjs invlbr invlisp invloadplugins invlz invmacatsui invmh invmod invmodifiable invmore invmousefocus invnu invodev invpaste invpreserveindent invprompt invreadonly invremap invrevins invrightleft invrnu invrs invruler invsc invscrollbind invsecure invshellslash invshiftround invshowcmd invshowmatch invsi invsmartcase invsmarttab invsn invspell invsplitright invsr invsta invstmp invswf invtagbsearch invtagstack invtbidi invtermbidi invtextauto invtf invtildeop invtitle invtop invttimeout invttyfast invudf invvb invwa invwb invwfh invwic invwildmenu invwinfixwidth invwmnu invwrapscan invwriteany invws
! syn keyword vimOption contained invakm invanti invarab invari invautoindent invautowriteall invbackup invbin invbioskey invbomb invci invcompatible invconskey invcrb invcscopeverbose invcsverb invcursorbind invdeco invdiff inveb invek invequalalways invet invexrc invfileignorecase invfoldenable invguipty invhk
" termcap codes (which can also be set) {{{2
syn keyword vimOption contained t_AB t_al t_bc t_ce t_cl t_Co t_Cs t_CS t_CV t_da t_db t_dl t_DL t_EI t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_fs t_IE t_IS t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_ke t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ks t_ku t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RI t_RV t_Sb t_se t_Sf t_SI t_so t_sr t_te t_ti t_ts t_u7 t_ue t_us t_ut t_vb t_ve t_vi t_vs t_WP t_WS t_xs t_ZH t_ZR
! syn keyword vimOption contained t_AF t_AL t_cd t_Ce t_cm t_cs
syn match vimOption contained "t_%1"
syn match vimOption contained "t_#2"
syn match vimOption contained "t_#4"
--- 33,53 ----
syn keyword vimOption contained al antialias autochdir background balloondelay bexpr bk bs casemap cf cink cmdheight colorcolumn completefunc copyindent cryptmethod cscopeverbose csverb debug dict dir eb enc errorbells expandtab fdl fenc fileencodings fkmap foldenable foldminlines formatprg gdefault gp guifontset helpfile hidden hl ignorecase imcmdline imsf indentexpr is isp keywordprg lazyredraw lispwords ls makeef maxmapdepth mfd mmd modified mousemodel msm numberwidth operatorfunc pastetoggle pexpr pmbfn printexpr pt re restorescreen rnu rulerformat scr sect sft shellredir shiftwidth showmatch siso smc spc spl ss statusline suffixesadd sws tabline tags tbs textmode timeoutlen to tsl ttyfast uc undoreload vdir viewoptions warn wfh wig wildmode winfixwidth wiw wrap writedelay
syn keyword vimOption contained aleph ar autoindent backspace ballooneval bg bkc bsdir cb cfu cinkeys cmdwinheight columns completeopt cot cscopepathcomp cspc cuc deco dictionary directory ed encoding errorfile exrc fdls fencs fileformat flp foldexpr foldnestmax fp gfm grepformat guifontwide helpheight highlight hlg im imd imstatusfunc indentkeys isf isprint km lbr list lsp makeprg maxmem mh mmp more mouses mzq nuw opfunc patchexpr pfn popt printfont pumheight readonly revins ro runtimepath scroll sections sh shellslash shm showmode sj smd spell splitbelow ssl stl sw sxe tabpagemax tagstack tenc textwidth title toolbar tsr ttym udf updatecount ve viminfo wb wfw wildchar wildoptions winheight wm wrapmargin ws
syn keyword vimOption contained allowrevins arab autoread backup balloonexpr bh bl bsk cc ch cino cmp com concealcursor cp cscopeprg csprg cul def diff display edcompatible endofline errorformat fcl fdm fex fileformats fml foldignore foldopen fs gfn grepprg guiheadroom helplang history hls imactivatefunc imdisable inc indk isfname joinspaces kmp lcs listchars lw mat maxmempattern mis mmt mouse mouseshape mzquantum odev osfiletype patchmode ph preserveindent printheader pvh redrawtime ri rs sb scrollbind secure shcf shelltemp shortmess showtabline slm sn spellcapcheck splitright ssop stmp swapfile sxq tabstop tal term tf titlelen toolbariconsize ttimeout ttymouse udir updatetime verbose virtualedit wc wh wildcharm wim winminheight wmh wrapscan ww
! syn keyword vimOption contained altkeymap arabic autowrite backupcopy bdir bin bomb bt ccv charconvert cinoptions cms comments conceallevel cpo cscopequickfix csqf cursorbind define diffexpr dy ef eol esckeys fcs fdn ff fileignorecase fmr foldlevel foldtext fsync gfs gtl guioptions hf hk hlsearch imactivatekey imi include inex isi js kp linebreak lm lz matchpairs maxmemtot mkspellmem mod mousef mouset nf oft pa path pheader previewheight printmbcharset pvw regexpengine rightleft rtp sbo scrolljump sel shell shelltype shortname shq sm so spellfile spr st sts swapsync syn tag tb termbidi tgst titleold top ttimeoutlen ttyscroll ul ur verbosefile visualbell guicolors
" vimOptions: These are the turn-off setting variants {{{2
syn keyword vimOption contained noacd noallowrevins noantialias noarabic noarshape noautoread noaw noballooneval nobinary nobk nobuflisted nocin noconfirm nocopyindent nocscoperelative nocsre nocuc nocursorcolumn nodelcombine nodigraph noed noendofline noerrorbells noex nofen nofk nogd nohid nohkmap nohkp nohlsearch noicon noim noimcmdline noimdisable noinf noinsertmode nojoinspaces nolazyredraw nolinebreak nolist nolpl noma nomagic noml nomodeline nomodified nomousef nomousehide nonumber noopendevice nopi nopreviewwindow nopvw norelativenumber norestorescreen nori norl noro noru nosb noscb noscs nosft noshelltemp noshortname noshowfulltag noshowmode nosm nosmartindent nosmd nosol nosplitbelow nospr nossl nostartofline noswapfile nota notagrelative notbi notbs noterse notextmode notgst notimeout noto notr nottybuiltin notx noundofile novisualbell nowarn noweirdinvert nowfw nowildignorecase nowinfixheight nowiv nowrap nowrite nowritebackup
syn keyword vimOption contained noai noaltkeymap noar noarabicshape noautochdir noautowrite noawa nobeval nobiosk nobl nocf nocindent noconsk nocp nocscopetag nocst nocul nocursorline nodg noea noedcompatible noeol noesckeys noexpandtab nofic nofkmap nogdefault nohidden nohkmapp nohls noic noignorecase noimc noimd noincsearch noinfercase nois nojs nolbr nolisp noloadplugins nolz nomacatsui nomh nomod nomodifiable nomore nomousefocus nonu noodev nopaste nopreserveindent noprompt noreadonly noremap norevins norightleft nornu nors noruler nosc noscrollbind nosecure noshellslash noshiftround noshowcmd noshowmatch nosi nosmartcase nosmarttab nosn nospell nosplitright nosr nosta nostmp noswf notagbsearch notagstack notbidi notermbidi notextauto notf notildeop notitle notop nottimeout nottyfast noudf novb nowa nowb nowfh nowic nowildmenu nowinfixwidth nowmnu nowrapscan nowriteany nows
! syn keyword vimOption contained noakm noanti noarab noari noautoindent noautowriteall nobackup nobin nobioskey nobomb noci nocompatible noconskey nocrb nocscopeverbose nocsverb nocursorbind nodeco nodiff noeb noek noequalalways noet noexrc nofileignorecase nofoldenable noguipty nohk noguicolors
" vimOptions: These are the invertible variants {{{2
syn keyword vimOption contained invacd invallowrevins invantialias invarabic invarshape invautoread invaw invballooneval invbinary invbk invbuflisted invcin invconfirm invcopyindent invcscoperelative invcsre invcuc invcursorcolumn invdelcombine invdigraph inved invendofline inverrorbells invex invfen invfk invgd invhid invhkmap invhkp invhlsearch invicon invim invimcmdline invimdisable invinf invinsertmode invjoinspaces invlazyredraw invlinebreak invlist invlpl invma invmagic invml invmodeline invmodified invmousef invmousehide invnumber invopendevice invpi invpreviewwindow invpvw invrelativenumber invrestorescreen invri invrl invro invru invsb invscb invscs invsft invshelltemp invshortname invshowfulltag invshowmode invsm invsmartindent invsmd invsol invsplitbelow invspr invssl invstartofline invswapfile invta invtagrelative invtbi invtbs invterse invtextmode invtgst invtimeout invto invtr invttybuiltin invtx invundofile invvisualbell invwarn invweirdinvert invwfw invwildignorecase invwinfixheight invwiv invwrap invwrite invwritebackup
syn keyword vimOption contained invai invaltkeymap invar invarabicshape invautochdir invautowrite invawa invbeval invbiosk invbl invcf invcindent invconsk invcp invcscopetag invcst invcul invcursorline invdg invea invedcompatible inveol invesckeys invexpandtab invfic invfkmap invgdefault invhidden invhkmapp invhls invic invignorecase invimc invimd invincsearch invinfercase invis invjs invlbr invlisp invloadplugins invlz invmacatsui invmh invmod invmodifiable invmore invmousefocus invnu invodev invpaste invpreserveindent invprompt invreadonly invremap invrevins invrightleft invrnu invrs invruler invsc invscrollbind invsecure invshellslash invshiftround invshowcmd invshowmatch invsi invsmartcase invsmarttab invsn invspell invsplitright invsr invsta invstmp invswf invtagbsearch invtagstack invtbidi invtermbidi invtextauto invtf invtildeop invtitle invtop invttimeout invttyfast invudf invvb invwa invwb invwfh invwic invwildmenu invwinfixwidth invwmnu invwrapscan invwriteany invws
! syn keyword vimOption contained invakm invanti invarab invari invautoindent invautowriteall invbackup invbin invbioskey invbomb invci invcompatible invconskey invcrb invcscopeverbose invcsverb invcursorbind invdeco invdiff inveb invek invequalalways invet invexrc invfileignorecase invfoldenable invguipty invhk invguicolors
" termcap codes (which can also be set) {{{2
syn keyword vimOption contained t_AB t_al t_bc t_ce t_cl t_Co t_Cs t_CS t_CV t_da t_db t_dl t_DL t_EI t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_fs t_IE t_IS t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_ke t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ks t_ku t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RI t_RV t_Sb t_se t_Sf t_SI t_so t_sr t_te t_ti t_ts t_u7 t_ue t_us t_ut t_vb t_ve t_vi t_vs t_WP t_WS t_xs t_ZH t_ZR
! syn keyword vimOption contained t_AF t_AL t_cd t_Ce t_cm t_cs t_8f t_8b
syn match vimOption contained "t_%1"
syn match vimOption contained "t_#2"
syn match vimOption contained "t_#4"
diff -crN vim-guicolors.03a813f2cf51/src/auto/configure vim-guicolors.64d20b6d9488/src/auto/configure
*** vim-guicolors.03a813f2cf51/src/auto/configure 2014-11-22 18:39:13.932656158 +0300
--- vim-guicolors.64d20b6d9488/src/auto/configure 2014-11-22 18:39:14.032656157 +0300
***************
*** 804,809 ****
--- 804,810 ----
enable_rubyinterp
with_ruby_command
enable_cscope
+ enable_termtruecolor
enable_workshop
enable_netbeans
enable_sniff
***************
*** 1467,1472 ****
--- 1468,1474 ----
--enable-tclinterp Include Tcl interpreter.
--enable-rubyinterp=OPTS Include Ruby interpreter. default=no OPTS=no/yes/dynamic
--enable-cscope Include cscope interface.
+ --enable-termtruecolor Include support for 24-bit colors in ISO-8613-3 compatible terminals
--enable-workshop Include Sun Visual Workshop support.
--disable-netbeans Disable NetBeans integration support.
--enable-sniff Include Sniff interface.
***************
*** 7087,7092 ****
--- 7089,7110 ----
fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-termtruecolor argument" >&5
+ $as_echo_n "checking --enable-termtruecolor argument... " >&6; }
+ # Check whether --enable-termtruecolor was given.
+ if test "${enable_termtruecolor+set}" = set; then :
+ enableval=$enable_termtruecolor;
+ else
+ enable_termtruecolor="no"
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_termtruecolor" >&5
+ $as_echo "$enable_termtruecolor" >&6; }
+ if test "$enable_termtruecolor" = "yes"; then
+ $as_echo "#define FEAT_TERMTRUECOLOR 1" >>confdefs.h
+
+ fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-workshop argument" >&5
$as_echo_n "checking --enable-workshop argument... " >&6; }
# Check whether --enable-workshop was given.
***************
*** 11447,11453 ****
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
! #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
--- 11465,11471 ----
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
! #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
***************
*** 11493,11499 ****
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
! #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
--- 11511,11517 ----
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
! #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
***************
*** 11517,11523 ****
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
! #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
--- 11535,11541 ----
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
! #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
***************
*** 11562,11568 ****
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
! #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
--- 11580,11586 ----
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
! #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
***************
*** 11586,11592 ****
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
! #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
--- 11604,11610 ----
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
! #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
diff -crN vim-guicolors.03a813f2cf51/src/config.h.in vim-guicolors.64d20b6d9488/src/config.h.in
*** vim-guicolors.03a813f2cf51/src/config.h.in 2014-11-22 18:39:13.912656158 +0300
--- vim-guicolors.64d20b6d9488/src/config.h.in 2014-11-22 18:39:14.012656157 +0300
***************
*** 360,365 ****
--- 360,368 ----
/* Define if you want to include the Tcl interpreter. */
#undef FEAT_TCL
+ /* Define if you want 24-bit colors in ISO-8613-3 compatible terminals. */
+ #undef FEAT_TERMTRUECOLOR
+
/* Define if you want to include the Sniff interface. */
#undef FEAT_SNIFF
diff -crN vim-guicolors.03a813f2cf51/src/configure.in vim-guicolors.64d20b6d9488/src/configure.in
*** vim-guicolors.03a813f2cf51/src/configure.in 2014-11-22 18:39:13.912656158 +0300
--- vim-guicolors.64d20b6d9488/src/configure.in 2014-11-22 18:39:14.012656157 +0300
***************
*** 1818,1823 ****
--- 1818,1832 ----
AC_DEFINE(FEAT_CSCOPE)
fi
+ AC_MSG_CHECKING(--enable-termtruecolor argument)
+ AC_ARG_ENABLE(termtruecolor,
+ [ --enable-termtruecolor Include support for 24-bit colors in ISO-8613-3 compatible terminals], ,
+ [enable_termtruecolor="no"])
+ AC_MSG_RESULT($enable_termtruecolor)
+ if test "$enable_termtruecolor" = "yes"; then
+ AC_DEFINE(FEAT_TERMTRUECOLOR)
+ fi
+
AC_MSG_CHECKING(--enable-workshop argument)
AC_ARG_ENABLE(workshop,
[ --enable-workshop Include Sun Visual Workshop support.], ,
diff -crN vim-guicolors.03a813f2cf51/src/eval.c vim-guicolors.64d20b6d9488/src/eval.c
*** vim-guicolors.03a813f2cf51/src/eval.c 2014-11-22 18:39:14.002656157 +0300
--- vim-guicolors.64d20b6d9488/src/eval.c 2014-11-22 18:39:14.062656157 +0300
***************
*** 12783,12788 ****
--- 12783,12791 ----
#ifdef FEAT_TERMRESPONSE
"termresponse",
#endif
+ #ifdef FEAT_TERMTRUECOLOR
+ "termtruecolor",
+ #endif
#ifdef FEAT_TEXTOBJ
"textobjects",
#endif
diff -crN vim-guicolors.03a813f2cf51/src/globals.h vim-guicolors.64d20b6d9488/src/globals.h
*** vim-guicolors.03a813f2cf51/src/globals.h 2014-11-22 18:39:13.902656158 +0300
--- vim-guicolors.64d20b6d9488/src/globals.h 2014-11-22 18:39:14.012656157 +0300
***************
*** 368,373 ****
--- 368,377 ----
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
+ EXTERN long_u cterm_normal_fg_gui_color INIT(= INVALCOLOR);
+ EXTERN long_u cterm_normal_bg_gui_color INIT(= INVALCOLOR);
+ #endif
#ifdef FEAT_AUTOCMD
EXTERN int autocmd_busy INIT(= FALSE); /* Is apply_autocmds() busy? */
diff -crN vim-guicolors.03a813f2cf51/src/hardcopy.c vim-guicolors.64d20b6d9488/src/hardcopy.c
*** vim-guicolors.03a813f2cf51/src/hardcopy.c 2014-11-22 18:39:13.952656158 +0300
--- vim-guicolors.64d20b6d9488/src/hardcopy.c 2014-11-22 18:39:14.042656157 +0300
***************
*** 284,291 ****
pattr->underline = (highlight_has_attr(hl_id, HL_UNDERLINE, modec) != NULL);
pattr->undercurl = (highlight_has_attr(hl_id, HL_UNDERCURL, modec) != NULL);
! # ifdef FEAT_GUI
! if (gui.in_use)
{
bg_color = highlight_gui_color_rgb(hl_id, FALSE);
if (bg_color == PRCOLOR_BLACK)
--- 284,291 ----
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 (USE_24BIT)
{
bg_color = highlight_gui_color_rgb(hl_id, FALSE);
if (bg_color == PRCOLOR_BLACK)
diff -crN vim-guicolors.03a813f2cf51/src/option.c vim-guicolors.64d20b6d9488/src/option.c
*** vim-guicolors.03a813f2cf51/src/option.c 2014-11-22 18:39:13.912656158 +0300
--- vim-guicolors.64d20b6d9488/src/option.c 2014-11-22 18:39:14.082656156 +0300
***************
*** 1296,1301 ****
--- 1296,1310 ----
{(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_COMMA|P_NODUP,
#ifdef CURSOR_SHAPE
(char_u *)&p_guicursor, PV_NONE,
***************
*** 2981,2986 ****
--- 2990,2997 ----
p_term("t_xs", T_XS)
p_term("t_ZH", T_CZH)
p_term("t_ZR", T_CZR)
+ p_term("t_8f", T_8F)
+ p_term("t_8b", T_8B)
/* terminal key codes are not in here */
***************
*** 8203,8208 ****
--- 8214,8230 ----
#endif
+ #ifdef FEAT_TERMTRUECOLOR
+ /* 'guicolors' */
+ else if ((int *)varp == &p_guicolors)
+ {
+ # ifdef FEAT_GUI
+ if (!gui.in_use && !gui.starting)
+ # endif
+ highlight_gui_started();
+ }
+ #endif
+
/*
* End of handling side effects for bool options.
*/
diff -crN vim-guicolors.03a813f2cf51/src/option.h vim-guicolors.64d20b6d9488/src/option.h
*** vim-guicolors.03a813f2cf51/src/option.h 2014-11-22 18:39:13.962656158 +0300
--- vim-guicolors.64d20b6d9488/src/option.h 2014-11-22 18:39:14.092656156 +0300
***************
*** 497,502 ****
--- 497,505 ----
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
diff -crN vim-guicolors.03a813f2cf51/src/proto/term.pro vim-guicolors.64d20b6d9488/src/proto/term.pro
*** vim-guicolors.03a813f2cf51/src/proto/term.pro 2014-11-22 18:39:14.002656157 +0300
--- vim-guicolors.64d20b6d9488/src/proto/term.pro 2014-11-22 18:39:14.092656156 +0300
***************
*** 59,62 ****
--- 59,67 ----
int show_one_termcode __ARGS((char_u *name, char_u *code, int printit));
char_u *translate_mapping __ARGS((char_u *str, int expmap));
void update_tcap __ARGS((int attr));
+ guicolor_T termtrue_mch_get_color __ARGS((char_u *name));
+ guicolor_T termtrue_get_color __ARGS((char_u *name));
+ long_u termtrue_mch_get_rgb __ARGS((guicolor_T color));
+ void term_fg_rgb_color __ARGS((long_u rgb));
+ void term_bg_rgb_color __ARGS((long_u rgb));
/* vim: set ft=c : */
diff -crN vim-guicolors.03a813f2cf51/src/screen.c vim-guicolors.64d20b6d9488/src/screen.c
*** vim-guicolors.03a813f2cf51/src/screen.c 2014-11-22 18:39:13.942656158 +0300
--- vim-guicolors.64d20b6d9488/src/screen.c 2014-11-22 18:39:14.042656157 +0300
***************
*** 7716,7722 ****
{
if (attr > HL_ALL) /* special HL attr. */
{
! if (t_colors > 1)
aep = syn_cterm_attr2entry(attr);
else
aep = syn_term_attr2entry(attr);
--- 7716,7722 ----
{
if (attr > HL_ALL) /* special HL attr. */
{
! if (IS_CTERM)
aep = syn_cterm_attr2entry(attr);
else
aep = syn_term_attr2entry(attr);
***************
*** 7727,7734 ****
}
if ((attr & HL_BOLD) && T_MD != NULL) /* bold */
out_str(T_MD);
! else if (aep != NULL && t_colors > 1 && aep->ae_u.cterm.fg_color
! && cterm_normal_fg_bold)
/* If the Normal FG color has BOLD attribute and the new HL
* has a FG color defined, clear BOLD. */
out_str(T_ME);
--- 7727,7742 ----
}
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 ?
! (aep->ae_u.cterm.fg_rgb != INVALCOLOR):
! #endif
! (t_colors > 1 && aep->ae_u.cterm.fg_color)
! #ifdef FEAT_TERMTRUECOLOR
! )
! #endif
! )
/* If the Normal FG color has BOLD attribute and the new HL
* has a FG color defined, clear BOLD. */
out_str(T_ME);
***************
*** 7748,7764 ****
*/
if (aep != NULL)
{
! if (t_colors > 1)
{
! if (aep->ae_u.cterm.fg_color)
! term_fg_color(aep->ae_u.cterm.fg_color - 1);
! if (aep->ae_u.cterm.bg_color)
! term_bg_color(aep->ae_u.cterm.bg_color - 1);
}
else
{
! if (aep->ae_u.term.start != NULL)
! out_str(aep->ae_u.term.start);
}
}
}
--- 7756,7784 ----
*/
if (aep != NULL)
{
! #ifdef FEAT_TERMTRUECOLOR
! if (p_guicolors)
{
! if (aep->ae_u.cterm.fg_rgb != INVALCOLOR)
! term_fg_rgb_color(aep->ae_u.cterm.fg_rgb);
! if (aep->ae_u.cterm.bg_rgb != INVALCOLOR)
! term_bg_rgb_color(aep->ae_u.cterm.bg_rgb);
}
else
+ #endif
{
! if (t_colors > 1)
! {
! if (aep->ae_u.cterm.fg_color)
! term_fg_color(aep->ae_u.cterm.fg_color - 1);
! if (aep->ae_u.cterm.bg_color)
! term_bg_color(aep->ae_u.cterm.bg_color - 1);
! }
! else
! {
! if (aep->ae_u.term.start != NULL)
! out_str(aep->ae_u.term.start);
! }
}
}
}
***************
*** 7792,7805 ****
{
attrentry_T *aep;
! if (t_colors > 1)
{
/*
* Assume that t_me restores the original colors!
*/
aep = syn_cterm_attr2entry(screen_attr);
! if (aep != NULL && (aep->ae_u.cterm.fg_color
! || aep->ae_u.cterm.bg_color))
do_ME = TRUE;
}
else
--- 7812,7834 ----
{
attrentry_T *aep;
! if (IS_CTERM)
{
/*
* Assume that t_me restores the original colors!
*/
aep = syn_cterm_attr2entry(screen_attr);
! if (aep != NULL &&
! #ifdef FEAT_TERMTRUECOLOR
! (p_guicolors ?
! (aep->ae_u.cterm.fg_rgb != INVALCOLOR ||
! aep->ae_u.cterm.bg_rgb != INVALCOLOR):
! #endif
! (aep->ae_u.cterm.fg_color || aep->ae_u.cterm.bg_color)
! #ifdef FEAT_TERMTRUECOLOR
! )
! #endif
! )
do_ME = TRUE;
}
else
***************
*** 7847,7861 ****
if (do_ME || (screen_attr & (HL_BOLD | HL_INVERSE)))
out_str(T_ME);
! if (t_colors > 1)
{
! /* set Normal cterm colors */
! if (cterm_normal_fg_color != 0)
! term_fg_color(cterm_normal_fg_color - 1);
! if (cterm_normal_bg_color != 0)
! term_bg_color(cterm_normal_bg_color - 1);
! if (cterm_normal_fg_bold)
! out_str(T_MD);
}
}
}
--- 7876,7902 ----
if (do_ME || (screen_attr & (HL_BOLD | HL_INVERSE)))
out_str(T_ME);
! #ifdef FEAT_TERMTRUECOLOR
! if (p_guicolors)
{
! if (cterm_normal_fg_gui_color != INVALCOLOR)
! term_fg_rgb_color(cterm_normal_fg_gui_color);
! if (cterm_normal_bg_gui_color != INVALCOLOR)
! term_bg_rgb_color(cterm_normal_bg_gui_color);
! }
! else
! #endif
! {
! if (t_colors > 1)
! {
! /* set Normal cterm colors */
! if (cterm_normal_fg_color != 0)
! term_fg_color(cterm_normal_fg_color - 1);
! if (cterm_normal_bg_color != 0)
! term_bg_color(cterm_normal_bg_color - 1);
! if (cterm_normal_fg_bold)
! out_str(T_MD);
! }
}
}
}
***************
*** 7869,7878 ****
void
reset_cterm_colors()
{
! if (t_colors > 1)
{
/* set Normal cterm colors */
if (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0)
{
out_str(T_OP);
screen_attr = -1;
--- 7910,7926 ----
void
reset_cterm_colors()
{
! if (IS_CTERM)
{
/* set Normal cterm colors */
+ #ifdef FEAT_TERMTRUECOLOR
+ if (p_guicolors ?
+ (cterm_normal_fg_gui_color != INVALCOLOR
+ || cterm_normal_bg_gui_color != INVALCOLOR):
+ (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0))
+ #else
if (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0)
+ #endif
{
out_str(T_OP);
screen_attr = -1;
***************
*** 8118,8124 ****
#ifdef FEAT_GUI
!gui.in_use &&
#endif
! t_colors <= 1);
for (row = start_row; row < end_row; ++row)
{
#ifdef FEAT_MBYTE
--- 8166,8172 ----
#ifdef FEAT_GUI
!gui.in_use &&
#endif
! !IS_CTERM);
for (row = start_row; row < end_row; ++row)
{
#ifdef FEAT_MBYTE
***************
*** 8812,8817 ****
--- 8860,8868 ----
#ifdef FEAT_GUI
|| gui.in_use
#endif
+ #ifdef FEAT_TERMTRUECOLOR
+ || (p_guicolors && cterm_normal_bg_gui_color != INVALCOLOR)
+ #endif
|| cterm_normal_bg_color == 0 || *T_UT != NUL));
}
***************
*** 10122,10127 ****
--- 10173,10181 ----
#ifdef FEAT_GUI
&& !gui.in_use
#endif
+ #ifdef FEAT_TERMTRUECOLOR
+ && !p_guicolors
+ #endif
);
redraw_tabline = FALSE;
diff -crN vim-guicolors.03a813f2cf51/src/structs.h vim-guicolors.64d20b6d9488/src/structs.h
*** vim-guicolors.03a813f2cf51/src/structs.h 2014-11-22 18:39:13.962656158 +0300
--- vim-guicolors.64d20b6d9488/src/structs.h 2014-11-22 18:39:14.042656157 +0300
***************
*** 84,90 ****
# ifdef FEAT_XCLIPBOARD
# include <X11/Intrinsic.h>
# endif
! # define guicolor_T int /* avoid error in prototypes */
#endif
/*
--- 84,92 ----
# ifdef FEAT_XCLIPBOARD
# include <X11/Intrinsic.h>
# endif
! # define guicolor_T long_u /* avoid error in prototypes and
! * make FEAT_TERMTRUECOLOR work */
! # define INVALCOLOR ((guicolor_T)0x1ffffff)
#endif
/*
***************
*** 911,916 ****
--- 913,922 ----
/* 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
+ long_u fg_rgb; /* foreground color RGB */
+ long_u bg_rgb; /* background color RGB */
+ # endif
} cterm;
# ifdef FEAT_GUI
struct
diff -crN vim-guicolors.03a813f2cf51/src/syntax.c vim-guicolors.64d20b6d9488/src/syntax.c
*** vim-guicolors.03a813f2cf51/src/syntax.c 2014-11-22 18:39:13.972656158 +0300
--- vim-guicolors.64d20b6d9488/src/syntax.c 2014-11-22 18:39:14.072656157 +0300
***************
*** 33,42 ****
int sg_cterm_fg; /* terminal fg color number + 1 */
int sg_cterm_bg; /* terminal bg color number + 1 */
int sg_cterm_attr; /* Screen attr for color term mode */
- #ifdef FEAT_GUI
/* for when using the GUI */
guicolor_T sg_gui_fg; /* GUI foreground color handle */
guicolor_T sg_gui_bg; /* GUI background color handle */
guicolor_T sg_gui_sp; /* GUI special color handle */
GuiFont sg_font; /* GUI font handle */
#ifdef FEAT_XFONTSET
--- 33,44 ----
int sg_cterm_fg; /* terminal fg color number + 1 */
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)
guicolor_T sg_gui_fg; /* GUI foreground color handle */
guicolor_T sg_gui_bg; /* GUI background color handle */
+ #endif
+ #ifdef FEAT_GUI
guicolor_T sg_gui_sp; /* GUI special color handle */
GuiFont sg_font; /* GUI font handle */
#ifdef FEAT_XFONTSET
***************
*** 97,106 ****
static int hl_has_settings __ARGS((int idx, int check_link));
static void highlight_clear __ARGS((int idx));
! #ifdef FEAT_GUI
static void gui_do_one_color __ARGS((int idx, int do_menu, int do_tooltip));
- static int set_group_colors __ARGS((char_u *name, guicolor_T *fgp, guicolor_T *bgp, int do_menu, int use_norm, int do_tooltip));
static guicolor_T color_name2handle __ARGS((char_u *name));
static GuiFont font_name2handle __ARGS((char_u *name));
# ifdef FEAT_XFONTSET
static GuiFontset fontset_name2handle __ARGS((char_u *name, int fixed_width));
--- 99,110 ----
static int hl_has_settings __ARGS((int idx, int check_link));
static void highlight_clear __ARGS((int idx));
! #if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
static void gui_do_one_color __ARGS((int idx, int do_menu, int do_tooltip));
static guicolor_T color_name2handle __ARGS((char_u *name));
+ #endif
+ #ifdef FEAT_GUI
+ static int set_group_colors __ARGS((char_u *name, guicolor_T *fgp, guicolor_T *bgp, int do_menu, int use_norm, int do_tooltip));
static GuiFont font_name2handle __ARGS((char_u *name));
# ifdef FEAT_XFONTSET
static GuiFontset fontset_name2handle __ARGS((char_u *name, int fixed_width));
***************
*** 7302,7309 ****
for (idx = 0; idx < highlight_ga.ga_len; ++idx)
highlight_clear(idx);
init_highlight(TRUE, TRUE);
! #ifdef FEAT_GUI
! if (gui.in_use)
highlight_gui_started();
#endif
highlight_changed();
--- 7306,7313 ----
for (idx = 0; idx < highlight_ga.ga_len; ++idx)
highlight_clear(idx);
init_highlight(TRUE, TRUE);
! #if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
! if (USE_24BIT)
highlight_gui_started();
#endif
highlight_changed();
***************
*** 7760,7769 ****
if (!init)
HL_TABLE()[idx].sg_set |= SG_GUI;
! # ifdef FEAT_GUI
/* In GUI guifg colors are only used when recognized */
i = color_name2handle(arg);
! if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !gui.in_use)
{
HL_TABLE()[idx].sg_gui_fg = i;
# endif
--- 7764,7779 ----
if (!init)
HL_TABLE()[idx].sg_set |= SG_GUI;
! # if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
/* 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
! # endif
! )
{
HL_TABLE()[idx].sg_gui_fg = i;
# endif
***************
*** 7772,7778 ****
HL_TABLE()[idx].sg_gui_fg_name = vim_strsave(arg);
else
HL_TABLE()[idx].sg_gui_fg_name = NULL;
! # ifdef FEAT_GUI
# ifdef FEAT_GUI_X11
if (is_menu_group)
gui.menu_fg_pixel = i;
--- 7782,7788 ----
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)
# ifdef FEAT_GUI_X11
if (is_menu_group)
gui.menu_fg_pixel = i;
***************
*** 7797,7806 ****
if (!init)
HL_TABLE()[idx].sg_set |= SG_GUI;
! # ifdef FEAT_GUI
/* In GUI guifg colors are only used when recognized */
i = color_name2handle(arg);
! if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !gui.in_use)
{
HL_TABLE()[idx].sg_gui_bg = i;
# endif
--- 7807,7816 ----
if (!init)
HL_TABLE()[idx].sg_set |= SG_GUI;
! # if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
/* In GUI guifg colors are only used when recognized */
i = color_name2handle(arg);
! if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT)
{
HL_TABLE()[idx].sg_gui_bg = i;
# endif
***************
*** 7809,7815 ****
HL_TABLE()[idx].sg_gui_bg_name = vim_strsave(arg);
else
HL_TABLE()[idx].sg_gui_bg_name = NULL;
! # ifdef FEAT_GUI
# ifdef FEAT_GUI_X11
if (is_menu_group)
gui.menu_bg_pixel = i;
--- 7819,7825 ----
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)
# ifdef FEAT_GUI_X11
if (is_menu_group)
gui.menu_bg_pixel = i;
***************
*** 7969,7975 ****
* Need to update all groups, because they might be using "bg"
* and/or "fg", which have been changed now.
*/
! if (gui.in_use)
highlight_gui_started();
#endif
}
--- 7979,7987 ----
* Need to update all groups, because they might be using "bg"
* and/or "fg", which have been changed now.
*/
! #endif
! #if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
! if (USE_24BIT)
highlight_gui_started();
#endif
}
***************
*** 8040,8045 ****
--- 8052,8061 ----
cterm_normal_fg_color = 0;
cterm_normal_fg_bold = 0;
cterm_normal_bg_color = 0;
+ # ifdef FEAT_TERMTRUECOLOR
+ cterm_normal_fg_gui_color = INVALCOLOR;
+ cterm_normal_bg_gui_color = INVALCOLOR;
+ # endif
#endif
}
***************
*** 8093,8101 ****
vim_free(HL_TABLE()[idx].sg_gui_sp_name);
HL_TABLE()[idx].sg_gui_sp_name = NULL;
#endif
! #ifdef FEAT_GUI
HL_TABLE()[idx].sg_gui_fg = INVALCOLOR;
HL_TABLE()[idx].sg_gui_bg = INVALCOLOR;
HL_TABLE()[idx].sg_gui_sp = INVALCOLOR;
gui_mch_free_font(HL_TABLE()[idx].sg_font);
HL_TABLE()[idx].sg_font = NOFONT;
--- 8109,8119 ----
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)
HL_TABLE()[idx].sg_gui_fg = INVALCOLOR;
HL_TABLE()[idx].sg_gui_bg = INVALCOLOR;
+ #endif
+ #ifdef FEAT_GUI
HL_TABLE()[idx].sg_gui_sp = INVALCOLOR;
gui_mch_free_font(HL_TABLE()[idx].sg_font);
HL_TABLE()[idx].sg_font = NOFONT;
***************
*** 8115,8121 ****
#endif
}
! #if defined(FEAT_GUI) || defined(PROTO)
/*
* Set the normal foreground and background colors according to the "Normal"
* highlighting group. For X11 also set "Menu", "Scrollbar", and
--- 8133,8139 ----
#endif
}
! #if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) || defined(PROTO)
/*
* Set the normal foreground and background colors according to the "Normal"
* highlighting group. For X11 also set "Menu", "Scrollbar", and
***************
*** 8124,8167 ****
void
set_normal_colors()
{
! if (set_group_colors((char_u *)"Normal",
! &gui.norm_pixel, &gui.back_pixel,
! FALSE, TRUE, FALSE))
! {
! gui_mch_new_colors();
! must_redraw = CLEAR;
! }
! #ifdef FEAT_GUI_X11
! if (set_group_colors((char_u *)"Menu",
! &gui.menu_fg_pixel, &gui.menu_bg_pixel,
! TRUE, FALSE, FALSE))
! {
! # ifdef FEAT_MENU
! gui_mch_new_menu_colors();
# endif
- must_redraw = CLEAR;
- }
- # ifdef FEAT_BEVAL
- if (set_group_colors((char_u *)"Tooltip",
- &gui.tooltip_fg_pixel, &gui.tooltip_bg_pixel,
- FALSE, FALSE, TRUE))
{
! # ifdef FEAT_TOOLBAR
! gui_mch_new_tooltip_colors();
# endif
- must_redraw = CLEAR;
}
#endif
! if (set_group_colors((char_u *)"Scrollbar",
! &gui.scroll_fg_pixel, &gui.scroll_bg_pixel,
! FALSE, FALSE, FALSE))
{
! gui_new_scrollbar_colors();
! must_redraw = CLEAR;
}
#endif
}
/*
* Set the colors for "Normal", "Menu", "Tooltip" or "Scrollbar".
*/
--- 8142,8219 ----
void
set_normal_colors()
{
! #ifdef FEAT_GUI
! # ifdef FEAT_TERMTRUECOLOR
! if (gui.in_use)
# endif
{
! if (set_group_colors((char_u *)"Normal",
! &gui.norm_pixel, &gui.back_pixel,
! FALSE, TRUE, FALSE))
! {
! gui_mch_new_colors();
! must_redraw = CLEAR;
! }
! # ifdef FEAT_GUI_X11
! if (set_group_colors((char_u *)"Menu",
! &gui.menu_fg_pixel, &gui.menu_bg_pixel,
! TRUE, FALSE, FALSE))
! {
! # ifdef FEAT_MENU
! gui_mch_new_menu_colors();
! # endif
! must_redraw = CLEAR;
! }
! # ifdef FEAT_BEVAL
! if (set_group_colors((char_u *)"Tooltip",
! &gui.tooltip_fg_pixel, &gui.tooltip_bg_pixel,
! FALSE, FALSE, TRUE))
! {
! # ifdef FEAT_TOOLBAR
! gui_mch_new_tooltip_colors();
! # endif
! must_redraw = CLEAR;
! }
! # endif
! if (set_group_colors((char_u *)"Scrollbar",
! &gui.scroll_fg_pixel, &gui.scroll_bg_pixel,
! FALSE, FALSE, FALSE))
! {
! gui_new_scrollbar_colors();
! must_redraw = CLEAR;
! }
# endif
}
#endif
! #ifdef FEAT_TERMTRUECOLOR
! # ifdef FEAT_GUI
! else
! # endif
{
! int idx;
!
! idx = syn_name2id((char_u *)"Normal") - 1;
! if (idx >= 0)
! {
! gui_do_one_color(idx, FALSE, FALSE);
!
! if (HL_TABLE()[idx].sg_gui_fg != INVALCOLOR)
! {
! cterm_normal_fg_gui_color = HL_TABLE()[idx].sg_gui_fg;
! must_redraw = CLEAR;
! }
! if (HL_TABLE()[idx].sg_gui_bg != INVALCOLOR)
! {
! cterm_normal_bg_gui_color = HL_TABLE()[idx].sg_gui_bg;
! must_redraw = CLEAR;
! }
! }
}
#endif
}
+ #endif
+ #if defined(FEAT_GUI) || defined(PROTO)
/*
* Set the colors for "Normal", "Menu", "Tooltip" or "Scrollbar".
*/
***************
*** 8275,8299 ****
}
/*
- * Return the handle for a color name.
- * Returns INVALCOLOR when failed.
- */
- static guicolor_T
- color_name2handle(name)
- char_u *name;
- {
- if (STRCMP(name, "NONE") == 0)
- return INVALCOLOR;
-
- if (STRICMP(name, "fg") == 0 || STRICMP(name, "foreground") == 0)
- return gui.norm_pixel;
- if (STRICMP(name, "bg") == 0 || STRICMP(name, "background") == 0)
- return gui.back_pixel;
-
- return gui_get_color(name);
- }
-
- /*
* Return the handle for a font name.
* Returns NOFONT when failed.
*/
--- 8327,8332 ----
***************
*** 8419,8424 ****
--- 8452,8504 ----
#endif /* FEAT_GUI */
+ #if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) || defined(PROTO)
+ /*
+ * Return the handle for a color name.
+ * Returns INVALCOLOR when failed.
+ */
+ static guicolor_T
+ color_name2handle(name)
+ char_u *name;
+ {
+ if (STRCMP(name, "NONE") == 0)
+ return INVALCOLOR;
+
+ if (STRICMP(name, "fg") == 0 || STRICMP(name, "foreground") == 0)
+ {
+ #if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI)
+ if (gui.in_use)
+ #endif
+ #ifdef FEAT_GUI
+ return gui.norm_pixel;
+ #endif
+ #if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI)
+ else
+ #endif
+ #ifdef FEAT_TERMTRUECOLOR
+ return cterm_normal_fg_gui_color;
+ #endif
+ }
+ if (STRICMP(name, "bg") == 0 || STRICMP(name, "background") == 0)
+ {
+ #if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI)
+ if (gui.in_use)
+ #endif
+ #ifdef FEAT_GUI
+ return gui.back_pixel;
+ #endif
+ #if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI)
+ else
+ #endif
+ #ifdef FEAT_TERMTRUECOLOR
+ return cterm_normal_bg_gui_color;
+ #endif
+ }
+
+ return GUI_GET_COLOR(name);
+ }
+ #endif
+
/*
* Table with the specifications for an attribute number.
* Note that this table is used by ALL buffers. This is required because the
***************
*** 8496,8503 ****
&& aep->ae_u.cterm.fg_color
== taep->ae_u.cterm.fg_color
&& aep->ae_u.cterm.bg_color
! == taep->ae_u.cterm.bg_color)
! ))
return i + ATTR_OFF;
}
--- 8576,8590 ----
&& aep->ae_u.cterm.fg_color
== taep->ae_u.cterm.fg_color
&& aep->ae_u.cterm.bg_color
! == taep->ae_u.cterm.bg_color
! #ifdef FEAT_TERMTRUECOLOR
! && aep->ae_u.cterm.fg_rgb
! == taep->ae_u.cterm.fg_rgb
! && aep->ae_u.cterm.bg_rgb
! == taep->ae_u.cterm.bg_rgb
! #endif
!
! )))
return i + ATTR_OFF;
}
***************
*** 8562,8567 ****
--- 8649,8658 ----
{
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
+ 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
}
++table->ga_len;
return (table->ga_len - 1 + ATTR_OFF);
***************
*** 8655,8661 ****
}
#endif
! if (t_colors > 1)
{
if (char_attr > HL_ALL)
char_aep = syn_cterm_attr2entry(char_attr);
--- 8746,8752 ----
}
#endif
! if (IS_CTERM)
{
if (char_attr > HL_ALL)
char_aep = syn_cterm_attr2entry(char_attr);
***************
*** 8680,8685 ****
--- 8771,8782 ----
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
+ if (spell_aep->ae_u.cterm.fg_rgb != INVALCOLOR)
+ new_en.ae_u.cterm.fg_rgb = spell_aep->ae_u.cterm.fg_rgb;
+ if (spell_aep->ae_u.cterm.bg_rgb != INVALCOLOR)
+ new_en.ae_u.cterm.bg_rgb = spell_aep->ae_u.cterm.bg_rgb;
+ #endif
}
}
return get_attr_entry(&cterm_attr_table, &new_en);
***************
*** 8743,8752 ****
aep = syn_gui_attr2entry(attr);
else
#endif
! if (t_colors > 1)
! aep = syn_cterm_attr2entry(attr);
! else
! aep = syn_term_attr2entry(attr);
if (aep == NULL) /* highlighting not set */
return 0;
--- 8840,8849 ----
aep = syn_gui_attr2entry(attr);
else
#endif
! if (IS_CTERM)
! aep = syn_cterm_attr2entry(attr);
! else
! aep = syn_term_attr2entry(attr);
if (aep == NULL) /* highlighting not set */
return 0;
***************
*** 8948,8960 ****
return NULL;
if (modec == 'g')
{
! # ifdef FEAT_GUI
/* return font name */
if (font)
return HL_TABLE()[id - 1].sg_font_name;
/* return #RRGGBB form (only possible when GUI is running) */
! if (gui.in_use && what[2] == '#')
{
guicolor_T color;
long_u rgb;
--- 9045,9059 ----
return NULL;
if (modec == 'g')
{
! # if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
! # ifdef FEAT_GUI
/* return font name */
if (font)
return HL_TABLE()[id - 1].sg_font_name;
+ # endif
/* return #RRGGBB form (only possible when GUI is running) */
! if ((USE_24BIT) && what[2] == '#')
{
guicolor_T color;
long_u rgb;
***************
*** 8963,8981 ****
if (fg)
color = HL_TABLE()[id - 1].sg_gui_fg;
else if (sp)
color = HL_TABLE()[id - 1].sg_gui_sp;
else
color = HL_TABLE()[id - 1].sg_gui_bg;
if (color == INVALCOLOR)
return NULL;
! rgb = gui_mch_get_rgb(color);
sprintf((char *)buf, "#%02x%02x%02x",
(unsigned)(rgb >> 16),
(unsigned)(rgb >> 8) & 255,
(unsigned)rgb & 255);
return buf;
}
! #endif
if (fg)
return (HL_TABLE()[id - 1].sg_gui_fg_name);
if (sp)
--- 9062,9084 ----
if (fg)
color = HL_TABLE()[id - 1].sg_gui_fg;
else if (sp)
+ # ifdef FEAT_GUI
color = HL_TABLE()[id - 1].sg_gui_sp;
+ # else
+ color = INVALCOLOR;
+ # endif
else
color = HL_TABLE()[id - 1].sg_gui_bg;
if (color == INVALCOLOR)
return NULL;
! rgb = GUI_MCH_GET_RGB(color);
sprintf((char *)buf, "#%02x%02x%02x",
(unsigned)(rgb >> 16),
(unsigned)(rgb >> 8) & 255,
(unsigned)rgb & 255);
return buf;
}
! # endif
if (fg)
return (HL_TABLE()[id - 1].sg_gui_fg_name);
if (sp)
***************
*** 8998,9005 ****
}
#endif
! #if (defined(FEAT_SYN_HL) && defined(FEAT_GUI) && defined(FEAT_PRINTER)) \
! || defined(PROTO)
/*
* Return color name of highlight group "id" as RGB value.
*/
--- 9101,9109 ----
}
#endif
! #if (defined(FEAT_SYN_HL) \
! && (defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)) \
! && defined(FEAT_PRINTER)) || defined(PROTO)
/*
* Return color name of highlight group "id" as RGB value.
*/
***************
*** 9021,9027 ****
if (color == INVALCOLOR)
return 0L;
! return gui_mch_get_rgb(color);
}
#endif
--- 9125,9131 ----
if (color == INVALCOLOR)
return 0L;
! return GUI_MCH_GET_RGB(color);
}
#endif
***************
*** 9137,9149 ****
* For the color term mode: If there are other than "normal"
* highlighting attributes, need to allocate an attr number.
*/
! if (sgp->sg_cterm_fg == 0 && sgp->sg_cterm_bg == 0)
sgp->sg_cterm_attr = sgp->sg_cterm;
else
{
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;
sgp->sg_cterm_attr = get_attr_entry(&cterm_attr_table, &at_en);
}
}
--- 9241,9262 ----
* For the color term mode: If there are other than "normal"
* highlighting attributes, need to allocate an attr number.
*/
! if (sgp->sg_cterm_fg == 0 && sgp->sg_cterm_bg == 0
! # ifdef FEAT_TERMTRUECOLOR
! && sgp->sg_gui_fg == INVALCOLOR
! && sgp->sg_gui_bg == INVALCOLOR
! # endif
! )
sgp->sg_cterm_attr = sgp->sg_cterm;
else
{
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
+ 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
sgp->sg_cterm_attr = get_attr_entry(&cterm_attr_table, &at_en);
}
}
***************
*** 9302,9311 ****
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);
! #ifdef FEAT_GUI
HL_TABLE()[highlight_ga.ga_len].sg_gui_bg = INVALCOLOR;
HL_TABLE()[highlight_ga.ga_len].sg_gui_fg = INVALCOLOR;
HL_TABLE()[highlight_ga.ga_len].sg_gui_sp = INVALCOLOR;
#endif
++highlight_ga.ga_len;
--- 9415,9426 ----
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)
HL_TABLE()[highlight_ga.ga_len].sg_gui_bg = INVALCOLOR;
HL_TABLE()[highlight_ga.ga_len].sg_gui_fg = INVALCOLOR;
+ # ifdef FEAT_GUI
HL_TABLE()[highlight_ga.ga_len].sg_gui_sp = INVALCOLOR;
+ # endif
#endif
++highlight_ga.ga_len;
***************
*** 9345,9351 ****
attr = sgp->sg_gui_attr;
else
#endif
! if (t_colors > 1)
attr = sgp->sg_cterm_attr;
else
attr = sgp->sg_term_attr;
--- 9460,9466 ----
attr = sgp->sg_gui_attr;
else
#endif
! if (IS_CTERM)
attr = sgp->sg_cterm_attr;
else
attr = sgp->sg_term_attr;
***************
*** 9403,9409 ****
return hl_id;
}
! #ifdef FEAT_GUI
/*
* Call this function just after the GUI has started.
* It finds the font and color handles for the highlighting groups.
--- 9518,9524 ----
return hl_id;
}
! #if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
/*
* Call this function just after the GUI has started.
* It finds the font and color handles for the highlighting groups.
***************
*** 9414,9420 ****
int idx;
/* First get the colors from the "Normal" and "Menu" group, if set */
! set_normal_colors();
for (idx = 0; idx < highlight_ga.ga_len; ++idx)
gui_do_one_color(idx, FALSE, FALSE);
--- 9529,9540 ----
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 (USE_24BIT)
! # endif
! set_normal_colors();
! # endif
for (idx = 0; idx < highlight_ga.ga_len; ++idx)
gui_do_one_color(idx, FALSE, FALSE);
***************
*** 9430,9441 ****
{
int didit = FALSE;
! if (HL_TABLE()[idx].sg_font_name != NULL)
! {
! hl_do_font(idx, HL_TABLE()[idx].sg_font_name, FALSE, do_menu,
do_tooltip, TRUE);
! didit = TRUE;
! }
if (HL_TABLE()[idx].sg_gui_fg_name != NULL)
{
HL_TABLE()[idx].sg_gui_fg =
--- 9550,9566 ----
{
int didit = FALSE;
! # ifdef FEAT_GUI
! # ifdef FEAT_TERMTRUECOLOR
! if (gui.in_use)
! # endif
! if (HL_TABLE()[idx].sg_font_name != NULL)
! {
! hl_do_font(idx, HL_TABLE()[idx].sg_font_name, FALSE, do_menu,
do_tooltip, TRUE);
! didit = TRUE;
! }
! # endif
if (HL_TABLE()[idx].sg_gui_fg_name != NULL)
{
HL_TABLE()[idx].sg_gui_fg =
***************
*** 9448,9463 ****
color_name2handle(HL_TABLE()[idx].sg_gui_bg_name);
didit = TRUE;
}
if (HL_TABLE()[idx].sg_gui_sp_name != NULL)
{
HL_TABLE()[idx].sg_gui_sp =
color_name2handle(HL_TABLE()[idx].sg_gui_sp_name);
didit = TRUE;
}
if (didit) /* need to get a new attr number */
set_hl_attr(idx);
}
-
#endif
/*
--- 9573,9589 ----
color_name2handle(HL_TABLE()[idx].sg_gui_bg_name);
didit = TRUE;
}
+ # ifdef FEAT_GUI
if (HL_TABLE()[idx].sg_gui_sp_name != NULL)
{
HL_TABLE()[idx].sg_gui_sp =
color_name2handle(HL_TABLE()[idx].sg_gui_sp_name);
didit = TRUE;
}
+ # endif
if (didit) /* need to get a new attr number */
set_hl_attr(idx);
}
#endif
/*
diff -crN vim-guicolors.03a813f2cf51/src/term.c vim-guicolors.64d20b6d9488/src/term.c
*** vim-guicolors.03a813f2cf51/src/term.c 2014-11-22 18:39:13.912656158 +0300
--- vim-guicolors.64d20b6d9488/src/term.c 2014-11-22 18:39:14.012656157 +0300
***************
*** 77,82 ****
--- 77,85 ----
static struct builtin_term *find_builtin_term __ARGS((char_u *name));
static void parse_builtin_tcap __ARGS((char_u *s));
static void term_color __ARGS((char_u *s, int n));
+ #ifdef FEAT_TERMTRUECOLOR
+ static void term_rgb_color __ARGS((char_u *s, long_u rgb));
+ #endif
static void gather_termleader __ARGS((void));
#ifdef FEAT_TERMRESPONSE
static void req_codes_from_term __ARGS((void));
***************
*** 376,384 ****
# else
{(int)KS_CRI, "\033[%dC"},
# endif
! #if defined(BEOS_DR8)
{(int)KS_DB, ""}, /* hack! see screen.c */
! #endif
{K_UP, "\033[A"},
{K_DOWN, "\033[B"},
--- 379,387 ----
# else
{(int)KS_CRI, "\033[%dC"},
# endif
! # if defined(BEOS_DR8)
{(int)KS_DB, ""}, /* hack! see screen.c */
! # endif
{K_UP, "\033[A"},
{K_DOWN, "\033[B"},
***************
*** 882,889 ****
# endif
# endif
! # if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS) || defined(__EMX__)
{(int)KS_NAME, "xterm"},
{(int)KS_CE, IF_EB("\033[K", ESC_STR "[K")},
{(int)KS_AL, IF_EB("\033[L", ESC_STR "[L")},
# ifdef TERMINFO
--- 885,894 ----
# endif
# endif
! # if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS) || defined(__EMX__) || defined(FEAT_TERMTRUECOLOR)
{(int)KS_NAME, "xterm"},
+ # endif
+ # if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS) || defined(__EMX__)
{(int)KS_CE, IF_EB("\033[K", ESC_STR "[K")},
{(int)KS_AL, IF_EB("\033[L", ESC_STR "[L")},
# ifdef TERMINFO
***************
*** 1030,1035 ****
--- 1035,1044 ----
{TERMCAP2KEY('F', 'Q'), IF_EB("\033[57;*~", ESC_STR "[57;*~")}, /* F36 */
{TERMCAP2KEY('F', 'R'), IF_EB("\033[58;*~", ESC_STR "[58;*~")}, /* F37 */
# endif
+ # ifdef FEAT_TERMTRUECOLOR
+ {(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")},
+ # endif
# if defined(UNIX) || defined(ALL_BUILTIN_TCAPS)
/*
***************
*** 1346,1351 ****
--- 1355,1527 ----
}; /* end of builtin_termcaps */
+ #if defined(FEAT_TERMTRUECOLOR) || defined(PROTO)
+ # define RGB(r, g, b) ((r<<16) | (g<<8) | (b))
+ struct rgbcolor_table_S {
+ char_u *color_name;
+ guicolor_T color;
+ };
+ static struct rgbcolor_table_S rgb_table[] = {
+ {(char_u *)"black", RGB(0x00, 0x00, 0x00)},
+ {(char_u *)"blue", RGB(0x00, 0x00, 0xD4)},
+ {(char_u *)"brown", RGB(0x80, 0x40, 0x40)},
+ {(char_u *)"cyan", RGB(0x02, 0xAB, 0xEA)},
+ {(char_u *)"darkblue", RGB(0x00, 0x00, 0x80)},
+ {(char_u *)"darkcyan", RGB(0x00, 0x80, 0x80)},
+ {(char_u *)"darkgray", RGB(0x80, 0x80, 0x80)},
+ {(char_u *)"darkgreen", RGB(0x00, 0x80, 0x00)},
+ {(char_u *)"darkgrey", RGB(0x80, 0x80, 0x80)},
+ {(char_u *)"darkmagenta", RGB(0x80, 0x00, 0x80)},
+ {(char_u *)"darkred", RGB(0x80, 0x00, 0x00)},
+ {(char_u *)"darkyellow", RGB(0xBB, 0xBB, 0x00)},
+ {(char_u *)"gray", RGB(0xC0, 0xC0, 0xC0)},
+ {(char_u *)"gray10", RGB(0x1A, 0x1A, 0x1A)},
+ {(char_u *)"gray20", RGB(0x33, 0x33, 0x33)},
+ {(char_u *)"gray30", RGB(0x4D, 0x4D, 0x4D)},
+ {(char_u *)"gray40", RGB(0x66, 0x66, 0x66)},
+ {(char_u *)"gray50", RGB(0x7F, 0x7F, 0x7F)},
+ {(char_u *)"gray60", RGB(0x99, 0x99, 0x99)},
+ {(char_u *)"gray70", RGB(0xB3, 0xB3, 0xB3)},
+ {(char_u *)"gray80", RGB(0xCC, 0xCC, 0xCC)},
+ {(char_u *)"gray90", RGB(0xE5, 0xE5, 0xE5)},
+ {(char_u *)"green", RGB(0x00, 0x64, 0x11)},
+ {(char_u *)"grey", RGB(0xC0, 0xC0, 0xC0)},
+ {(char_u *)"grey10", RGB(0x1A, 0x1A, 0x1A)},
+ {(char_u *)"grey20", RGB(0x33, 0x33, 0x33)},
+ {(char_u *)"grey30", RGB(0x4D, 0x4D, 0x4D)},
+ {(char_u *)"grey40", RGB(0x66, 0x66, 0x66)},
+ {(char_u *)"grey50", RGB(0x7F, 0x7F, 0x7F)},
+ {(char_u *)"grey60", RGB(0x99, 0x99, 0x99)},
+ {(char_u *)"grey70", RGB(0xB3, 0xB3, 0xB3)},
+ {(char_u *)"grey80", RGB(0xCC, 0xCC, 0xCC)},
+ {(char_u *)"grey90", RGB(0xE5, 0xE5, 0xE5)},
+ {(char_u *)"lightblue", RGB(0xA0, 0xA0, 0xFF)},
+ {(char_u *)"lightcyan", RGB(0xA0, 0xFF, 0xFF)},
+ {(char_u *)"lightgray", RGB(0xE0, 0xE0, 0xE0)},
+ {(char_u *)"lightgreen", RGB(0xA0, 0xFF, 0xA0)},
+ {(char_u *)"lightgrey", RGB(0xE0, 0xE0, 0xE0)},
+ {(char_u *)"lightmagenta",RGB(0xF0, 0xA0, 0xF0)},
+ {(char_u *)"lightred", RGB(0xFF, 0xA0, 0xA0)},
+ {(char_u *)"lightyellow", RGB(0xFF, 0xFF, 0xA0)},
+ {(char_u *)"magenta", RGB(0xF2, 0x08, 0x84)},
+ {(char_u *)"orange", RGB(0xFC, 0x80, 0x00)},
+ {(char_u *)"purple", RGB(0xA0, 0x20, 0xF0)},
+ {(char_u *)"red", RGB(0xDD, 0x08, 0x06)},
+ {(char_u *)"seagreen", RGB(0x2E, 0x8B, 0x57)},
+ {(char_u *)"slateblue", RGB(0x6A, 0x5A, 0xCD)},
+ {(char_u *)"violet", RGB(0x8D, 0x38, 0xC9)},
+ {(char_u *)"white", RGB(0xFF, 0xFF, 0xFF)},
+ {(char_u *)"yellow", RGB(0xFC, 0xF3, 0x05)},
+ };
+
+ static int
+ hex_digit(int c)
+ {
+ if (isdigit(c))
+ return c - '0';
+ c = TOLOWER_ASC(c);
+ if (c >= 'a' && c <= 'f')
+ return c - 'a' + 10;
+ return 0x1ffffff;
+ }
+
+ guicolor_T
+ termtrue_mch_get_color(char_u *name)
+ {
+ guicolor_T color;
+ int i;
+
+ if (*name == '#' && strlen((char *) name) == 7)
+ {
+ color = RGB(((hex_digit(name[1])<<4) + hex_digit(name[2])),
+ ((hex_digit(name[3])<<4) + hex_digit(name[4])),
+ ((hex_digit(name[5])<<4) + hex_digit(name[6])));
+ if (color > 0xffffff)
+ return INVALCOLOR;
+ return color;
+ }
+ else
+ {
+ /* Check if the name is one of the colors we know */
+ for (i = 0; i < sizeof(rgb_table) / sizeof(rgb_table[0]); i++)
+ if (STRICMP(name, rgb_table[i].color_name) == 0)
+ return rgb_table[i].color;
+ }
+
+ /*
+ * Last attempt. Look in the file "$VIM/rgb.txt".
+ */
+ {
+ #define LINE_LEN 100
+ FILE *fd;
+ char line[LINE_LEN];
+ char_u *fname;
+ int r, g, b;
+
+ fname = expand_env_save((char_u *)"$VIMRUNTIME/rgb.txt");
+ if (fname == NULL)
+ return INVALCOLOR;
+
+ fd = fopen((char *)fname, "rt");
+ vim_free(fname);
+ if (fd == NULL)
+ return INVALCOLOR;
+
+ while (!feof(fd))
+ {
+ int len;
+ int pos;
+ char *color;
+
+ fgets(line, LINE_LEN, fd);
+ len = strlen(line);
+
+ if (len <= 1 || line[len-1] != '\n')
+ continue;
+
+ line[len-1] = '\0';
+
+ i = sscanf(line, "%d %d %d %n", &r, &g, &b, &pos);
+ if (i != 3)
+ continue;
+
+ color = line + pos;
+
+ if (STRICMP(color, name) == 0)
+ {
+ fclose(fd);
+ return (guicolor_T) RGB(r, g, b);
+ }
+ }
+ fclose(fd);
+ }
+
+ return INVALCOLOR;
+ }
+
+ guicolor_T
+ termtrue_get_color(name)
+ char_u *name;
+ {
+ guicolor_T t;
+
+ if (*name == NUL)
+ return INVALCOLOR;
+ t = termtrue_mch_get_color(name);
+
+ if (t == INVALCOLOR)
+ EMSG2(_("E254: Cannot allocate color %s"), name);
+ return t;
+ }
+
+ long_u
+ termtrue_mch_get_rgb(color)
+ guicolor_T color;
+ {
+ return (long_u) color;
+ }
+ #endif
+
/*
* DEFAULT_TERM is used, when no terminal is specified with -T option or $TERM.
*/
***************
*** 1612,1617 ****
--- 1788,1794 ----
{KS_CWP, "WP"}, {KS_CWS, "WS"},
{KS_CSI, "SI"}, {KS_CEI, "EI"},
{KS_U7, "u7"},
+ {KS_8F, "8f"}, {KS_8B, "8b"},
{(enum SpecialKey)0, NULL}
};
***************
*** 2758,2763 ****
--- 2935,2969 ----
OUT_STR(tgoto((char *)s, 0, n));
}
+ #if defined(FEAT_TERMTRUECOLOR) || defined(PROTO)
+ void
+ term_fg_rgb_color(rgb)
+ long_u rgb;
+ {
+ term_rgb_color(T_8F, rgb);
+ }
+
+ void
+ term_bg_rgb_color(rgb)
+ long_u rgb;
+ {
+ term_rgb_color(T_8B, rgb);
+ }
+
+ #define RED(rgb) ((rgb>>16)&0xFF)
+ #define GREEN(rgb) ((rgb>> 8)&0xFF)
+ #define BLUE(rgb) ((rgb )&0xFF)
+ static void
+ term_rgb_color(s, rgb)
+ char_u *s;
+ long_u rgb;
+ {
+ char buf[7+3*3+2+1+1];
+ sprintf(buf, (char *)s, RED(rgb), GREEN(rgb), BLUE(rgb));
+ OUT_STR(buf);
+ }
+ #endif
+
#if (defined(FEAT_TITLE) && (defined(UNIX) || defined(OS2) || defined(VMS) || defined(MACOS_X))) || defined(PROTO)
/*
* Generic function to set window title, using t_ts and t_fs.
diff -crN vim-guicolors.03a813f2cf51/src/term.h vim-guicolors.64d20b6d9488/src/term.h
*** vim-guicolors.03a813f2cf51/src/term.h 2014-11-22 18:39:13.962656158 +0300
--- vim-guicolors.64d20b6d9488/src/term.h 2014-11-22 18:39:14.062656157 +0300
***************
*** 84,93 ****
KS_CSV, /* scroll region vertical */
#endif
KS_OP, /* original color pair */
! KS_U7 /* request cursor position */
};
! #define KS_LAST KS_U7
/*
* the terminal capabilities are stored in this array
--- 84,95 ----
KS_CSV, /* scroll region vertical */
#endif
KS_OP, /* original color pair */
! KS_U7, /* request cursor position */
! KS_8F, /* set foreground color (RGB) */
! KS_8B /* set background color (RGB) */
};
! #define KS_LAST KS_8B
/*
* the terminal capabilities are stored in this array
***************
*** 160,165 ****
--- 162,169 ----
#define T_CRV (term_str(KS_CRV)) /* request version string */
#define T_OP (term_str(KS_OP)) /* original color pair */
#define T_U7 (term_str(KS_U7)) /* request cursor position */
+ #define T_8F (term_str(KS_8F)) /* set foreground color (RGB) */
+ #define T_8B (term_str(KS_8B)) /* set background color (RGB) */
#define TMODE_COOK 0 /* terminal mode for external cmds and Ex mode */
#define TMODE_SLEEP 1 /* terminal mode for sleeping (cooked but no echo) */
diff -crN vim-guicolors.03a813f2cf51/src/version.c vim-guicolors.64d20b6d9488/src/version.c
*** vim-guicolors.03a813f2cf51/src/version.c 2014-11-22 18:39:13.962656158 +0300
--- vim-guicolors.64d20b6d9488/src/version.c 2014-11-22 18:39:14.042656157 +0300
***************
*** 619,624 ****
--- 619,629 ----
#else
"-termresponse",
#endif
+ #ifdef FEAT_TERMTRUECOLOR
+ "+termtruecolor",
+ #else
+ "-termtruecolor",
+ #endif
#ifdef FEAT_TEXTOBJ
"+textobjects",
#else
diff -crN vim-guicolors.03a813f2cf51/src/vim.h vim-guicolors.64d20b6d9488/src/vim.h
*** vim-guicolors.03a813f2cf51/src/vim.h 2014-11-22 18:39:13.972656158 +0300
--- vim-guicolors.64d20b6d9488/src/vim.h 2014-11-22 18:39:14.072656157 +0300
***************
*** 1598,1603 ****
--- 1598,1628 ----
#define MSG_PUTS_LONG(s) msg_puts_long_attr((char_u *)(s), 0)
#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)
+ # 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
+ # endif
+ #endif
+ #ifdef FEAT_TERMTRUECOLOR
+ # define IS_CTERM (t_colors > 1 || p_guicolors)
+ #else
+ # define IS_CTERM (t_colors > 1)
+ #endif
+ #ifdef GUI_FUNCTION
+ # define GUI_MCH_GET_RGB GUI_FUNCTION(mch_get_rgb)
+ # define GUI_MCH_GET_COLOR GUI_FUNCTION(mch_get_color)
+ # define GUI_GET_COLOR GUI_FUNCTION(get_color)
+ #endif
+
/* Prefer using emsg3(), because perror() may send the output to the wrong
* destination and mess up the screen. */
#ifdef HAVE_STRERROR