Prevent CSApprox from trashing 'background'

Whenever you change the Normal highlight group, vim always changes 'bg'
to light; try:
vim -u NONE -N -c 'set bg=dark' -c 'hi Normal ctermbg=16 ctermfg=255'

This change just makes CSApprox save/restore 'bg' before/after changing
the highlight groups.

Suggestion made by Kris Malfettone (and I'm sure that someone else
pointed this issue out to me in the past, but I didn't act on it then
and forgot who you are, so I'm sorry for not crediting you).
This commit is contained in:
Matt Wozniski 2010-07-17 20:48:53 -04:00
parent 4b6b1648d0
commit 88df3d0093

View File

@ -632,9 +632,13 @@ function! s:CSApprox(...)
call s:HandleHooks("pre", (exists("colors_name") ? colors_name : ""))
let old_bg = &bg
" Set 'verbose' set to the maximum of &verbose and CSApprox_verbose_level
exe max([&vbs, g:CSApprox_verbose_level]) 'verbose call s:CSApproxImpl()'
let &bg = old_bg
call s:HandleHooks("post", (exists("colors_name") ? colors_name : ""))
finally
if exists("colors_name")
@ -894,9 +898,7 @@ command! -bang -nargs=1 -complete=file -bar CSApproxSnapshot
" {>2} Manual updates
command -bang -bar CSApprox call s:CSApprox(strlen("<bang>"))
" {>1} Hooks
" {>2} Autocmds
" {>1} Autocmds
" Set up an autogroup to hook us on the completion of any :colorscheme command
augroup CSApprox
au!