From 9bb9b79a7041254d72ca6a953439966b0232451b Mon Sep 17 00:00:00 2001 From: Viacheslav Lotsmanov Date: Mon, 20 Aug 2018 21:28:28 +0300 Subject: [PATCH] fix #95 https://github.com/ap/vim-css-color/issues/95 --- autoload/css_color.vim | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/autoload/css_color.vim b/autoload/css_color.vim index 439fbed..c3a0787 100644 --- a/autoload/css_color.vim +++ b/autoload/css_color.vim @@ -184,7 +184,13 @@ endfunction function! s:create_matches() call s:clear_matches() - if ! &l:cursorline | return | endif + + " WARNING! Do not make it be one-liner by using '|' separator, it causes this bug: + " https://github.com/ap/vim-css-color/issues/95 + if ! &l:cursorline + return + endif + " adds matches based that duplicate the highlighted colors on the current line let lnr = line('.') let group = '' @@ -231,7 +237,12 @@ function! css_color#reinit() endfunction function! css_color#enable() - if len( b:css_color_grp ) | exe 'syn cluster colorableGroup add=' . join( b:css_color_grp, ',' ) | endif + " WARNING! Do not make it be one-liner by using '|' separator, it causes this bug: + " https://github.com/ap/vim-css-color/issues/95 + if len( b:css_color_grp ) + exe 'syn cluster colorableGroup add=' . join( b:css_color_grp, ',' ) + endif + autocmd CSSColor CursorMoved,CursorMovedI call s:parse_screen() | call s:create_matches() let b:css_color_off = 0 call s:parse_screen()