From 09dbd09ed3b6318ca4c3cda8f61f02f1bc8ce783 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Tue, 9 Mar 2021 13:50:18 +0100 Subject: [PATCH] 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 --- autoload/airline/highlighter.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/autoload/airline/highlighter.vim b/autoload/airline/highlighter.vim index 0889f2d3..b35ae793 100644 --- a/autoload/airline/highlighter.vim +++ b/autoload/airline/highlighter.vim @@ -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)