highlighter: handle color names when converting into msdos codes
the highlighter code tries to convert the RGB colors into appropriate color codes for the MSDOS palette. Unfortunately, it does not consider color names and tries to split those into a list of 3 RGB codes. This failes for names shorter 6 characters, causing a list index out of bounds error. Fix this by making sure, that the color code should start with '#' and in case it does not, assume it is a color name and simple return the name in that case. closes #2350
This commit is contained in:
parent
a262ec6ce4
commit
09dbd09ed3
|
@ -18,6 +18,9 @@ function! s:gui2cui(rgb, fallback) abort
|
|||
return a:fallback
|
||||
elseif match(a:rgb, '^\%(NONE\|[fb]g\)$') > -1
|
||||
return a:rgb
|
||||
elseif a:rgb[0] !~ '#'
|
||||
" a:rgb contains colorname
|
||||
return a:rgb
|
||||
endif
|
||||
let rgb = map(split(a:rgb[1:], '..\zs'), '0 + ("0x".v:val)')
|
||||
return airline#msdos#round_msdos_colors(rgb)
|
||||
|
|
Loading…
Reference in New Issue