chrisbra / Colorizer

color hex codes and color names
549 stars 31 forks source link

Do not duplicate guibg/guifg #75

Closed nickspoons closed 5 years ago

nickspoons commented 5 years ago

PR #73 broke highlighting in neovim, and after some debugging I see that that PR was resolving the issue in the wrong way.

The issue was that statements of the form highlight QuickFixLine NONE would pass argument a:Dict to s:DoHlGroup containing simply {'name': 'QuickFixLine'}, with no fg/bg properties. PR #73 resolved this by ensuring these properties were included in the resulting command: hi Color_QuickFixLine guibg= guifg=.

However, highlights that did have fg/bg properties were subsequently resulting in a command with duplicate guifg/guibg elements, like this: hi Color_000000_98c379 guifg=#000000 guibg=#98c379 guibg= guifg=. In Vim this worked fine - the first guifg/guibg element was used and the 2nd ignored, but in neovim it is the other way around, so all highlights were being set to guibg= guifg=.

This PR rolls those changes back, and simply ensures that the guifg/guibg elements are always included in the command, even when they are empty:

hi Color_QuickFixLine guifg= guibg=
hi Color_000000_98c379 guifg=#000000 guibg=#98c379

Closes #74

chrisbra commented 5 years ago

Thanks! I haven't had the chance to take a closer look, thanks for stepping in. This is very much appreciated.

petobens commented 5 years ago

Awesome. Thanks!