diff --git a/doc/CSApprox.txt b/doc/CSApprox.txt index 544851b..dc5f853 100644 --- a/doc/CSApprox.txt +++ b/doc/CSApprox.txt @@ -213,6 +213,20 @@ g:CSApprox_verbose_level *g:CSApprox_verbose_level* shown at verbosity level 1; some less important ones will be shown at higher verbosity levels. Has no effect on snapshotted schemes. +g:CSApprox_fake_reverse *g:CSApprox_fake_reverse* + In gvim, setting a highlight group like "Visual" (the color of your visual + mode selection) to do reverse video results in it reversing the colors of + each character cell under it. Some terminals don't support this and will + instead always use the default background color on the default foreground + color when asked for reverse video. If this variable is set to a non-zero + number, CSApprox will change any request for reverse video to the "Normal" + group's bg color on the "Normal" group's fg color, instead of asking the + terminal to do reverse video. This provides a middle ground for terminals + that don't properly support reverse video - it's worse than having the + terminal properly reverse the colors of each character cell, but it's + better than the broken behavior of some terminal emulators. This was the + default behavior before CSApprox 4.0. + g:CSApprox_eterm *g:CSApprox_eterm* If set to a non-zero number, CSApprox will use the Eterm palette when 'term' is set to "xterm" or begins with "screen". Otherwise, the xterm diff --git a/plugin/CSApprox.vim b/plugin/CSApprox.vim index 54612d9..b762404 100644 --- a/plugin/CSApprox.vim +++ b/plugin/CSApprox.vim @@ -396,16 +396,18 @@ function! s:FixupCtermInfo(highlights) let hl.cterm[s:attr_map('sp')] = hl.gui['sp'] endif - if hl.cterm['reverse'] && hl.cterm.bg == '' - let hl.cterm.bg = 'fg' - endif + if exists("g:CSApprox_fake_reverse") && g:CSApprox_fake_reverse + if hl.cterm['reverse'] && hl.cterm.bg == '' + let hl.cterm.bg = 'fg' + endif - if hl.cterm['reverse'] && hl.cterm.fg == '' - let hl.cterm.fg = 'bg' - endif + if hl.cterm['reverse'] && hl.cterm.fg == '' + let hl.cterm.fg = 'bg' + endif - if hl.cterm['reverse'] - let hl.cterm.reverse = '' + if hl.cterm['reverse'] + let hl.cterm.reverse = '' + endif endif endfor endfunction @@ -480,7 +482,7 @@ function! s:SetCtermFromGui(hl) endfor " Finally, set the attributes - let attrs = [ 'bold', 'italic', 'underline', 'undercurl' ] + let attrs = [ 'bold', 'italic', 'reverse', 'underline', 'undercurl' ] call filter(attrs, 'hl.cterm[v:val] == 1') if !empty(attrs) @@ -846,7 +848,7 @@ function! s:CSApproxSnapshot(file, overwrite) let hl = highlights[hlnum] let line = ' CSAHi ' . hl.name for type in [ 'term', 'cterm', 'gui' ] - let attrs = [ 'reverse', 'bold', 'italic', 'underline', 'undercurl' ] + let attrs = [ 'bold', 'italic', 'reverse', 'underline', 'undercurl' ] call filter(attrs, 'hl[type][v:val] == 1') let line .= ' ' . type . '=' . (empty(attrs) ? 'NONE' : join(attrs, ',')) if type != 'term'