Skip "abort if high color set" logic for snapshots

Before, snapshots wouldn't work right for high color schemes, since
CSApproxImpl aborted early when a high color was found.  If the user
wanted this, though, they wouldn't have called CSApproxSnapshot.  So,
skip this logic in that case.
This commit is contained in:
Matt Wozniski 2009-01-17 01:26:57 -05:00
parent f8019878d0
commit e5ebdd692f

View File

@ -688,6 +688,9 @@ function! s:CSApproxImpl()
" sure that no groups are set to a value above 256, unless the color they're
" set to can be set internally by vim (gotten by scraping
" color_numbers_{88,256} in syntax.c:do_highlight)
"
" XXX: s:inhibit_hicolor_test allows this test to be skipped for snapshots
if !exists("s:inhibit_hicolor_test") || !s:inhibit_hicolor_test
for hlid in hinums
let val = highlights[hlid]
if ( val.cterm.bg > 15
@ -701,6 +704,7 @@ function! s:CSApproxImpl()
return
endif
endfor
endif
call s:FixupGuiInfo(highlights)
call s:FixupCtermInfo(highlights)
@ -747,6 +751,7 @@ function! s:CSApproxSnapshot(file, overwrite)
endif
let save_t_Co = &t_Co
let s:inhibit_hicolor_test = 1
try
let lines = []
@ -788,6 +793,7 @@ function! s:CSApproxSnapshot(file, overwrite)
call writefile(lines, file)
finally
let &t_Co = save_t_Co
unlet s:inhibit_hicolor_test
endtry
endfunction