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:
parent
f8019878d0
commit
e5ebdd692f
@ -688,19 +688,23 @@ function! s:CSApproxImpl()
|
|||||||
" sure that no groups are set to a value above 256, unless the color they're
|
" 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
|
" set to can be set internally by vim (gotten by scraping
|
||||||
" color_numbers_{88,256} in syntax.c:do_highlight)
|
" color_numbers_{88,256} in syntax.c:do_highlight)
|
||||||
for hlid in hinums
|
"
|
||||||
let val = highlights[hlid]
|
" XXX: s:inhibit_hicolor_test allows this test to be skipped for snapshots
|
||||||
if ( val.cterm.bg > 15
|
if !exists("s:inhibit_hicolor_test") || !s:inhibit_hicolor_test
|
||||||
\ && index(s:presets_{&t_Co}, str2nr(val.cterm.bg)) < 0)
|
for hlid in hinums
|
||||||
\ || ( val.cterm.fg > 15
|
let val = highlights[hlid]
|
||||||
\ && index(s:presets_{&t_Co}, str2nr(val.cterm.fg)) < 0)
|
if ( val.cterm.bg > 15
|
||||||
" The value is set above 15, and wasn't set by vim.
|
\ && index(s:presets_{&t_Co}, str2nr(val.cterm.bg)) < 0)
|
||||||
if &verbose >= 2
|
\ || ( val.cterm.fg > 15
|
||||||
echomsg 'CSApprox: Exiting - high color found for' val.name
|
\ && index(s:presets_{&t_Co}, str2nr(val.cterm.fg)) < 0)
|
||||||
|
" The value is set above 15, and wasn't set by vim.
|
||||||
|
if &verbose >= 2
|
||||||
|
echomsg 'CSApprox: Exiting - high color found for' val.name
|
||||||
|
endif
|
||||||
|
return
|
||||||
endif
|
endif
|
||||||
return
|
endfor
|
||||||
endif
|
endif
|
||||||
endfor
|
|
||||||
|
|
||||||
call s:FixupGuiInfo(highlights)
|
call s:FixupGuiInfo(highlights)
|
||||||
call s:FixupCtermInfo(highlights)
|
call s:FixupCtermInfo(highlights)
|
||||||
@ -747,6 +751,7 @@ function! s:CSApproxSnapshot(file, overwrite)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let save_t_Co = &t_Co
|
let save_t_Co = &t_Co
|
||||||
|
let s:inhibit_hicolor_test = 1
|
||||||
|
|
||||||
try
|
try
|
||||||
let lines = []
|
let lines = []
|
||||||
@ -788,6 +793,7 @@ function! s:CSApproxSnapshot(file, overwrite)
|
|||||||
call writefile(lines, file)
|
call writefile(lines, file)
|
||||||
finally
|
finally
|
||||||
let &t_Co = save_t_Co
|
let &t_Co = save_t_Co
|
||||||
|
unlet s:inhibit_hicolor_test
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user