New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix "normal" highlighting with termguicolors #1344
Conversation
@@ -8765,6 +8765,8 @@ hl_combine_attr(int char_attr, int prim_attr) | |||
else | |||
{ | |||
vim_memset(&new_en, 0, sizeof(new_en)); | |||
new_en.ae_u.cterm.bg_rgb = INVALCOLOR; | |||
new_en.ae_u.cterm.fg_rgb = INVALCOLOR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the detailed bug report and proposing the patch for that.
Looks some CI tests about the builds not supporting termguicolors
failed. To fix that, how about enclosing those two new lines like this?
#ifdef FEAT_TERMGUICOLORS
(your new code)
#endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you're quite right!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
The 'uninitialised' value for RGB values is INVALCOLOR, but new entries in the cterm_attr_table were initialised to 0, meaning black. Fixes vim#1343
07c5745
to
c825124
Compare
Initialize to INVALCOLOR instead of zero. (Ben Jackson, closes vim#1344)
Problem: Normal colors are wrong with 'termguicolors'. Solution: Initialize to INVALCOLOR instead of zero. (Ben Jackson, closes vim#1344)
Problem: Normal colors are wrong with 'termguicolors'. Solution: Initialize to INVALCOLOR instead of zero. (Ben Jackson, closes vim/vim#1344) vim/vim@0cdb72a
Problem: Normal colors are wrong with 'termguicolors'. Solution: Initialize to INVALCOLOR instead of zero. (Ben Jackson, closes vim/vim#1344) vim/vim@0cdb72a
see also #7082 Problem: Normal colors are wrong with 'termguicolors'. Solution: Initialize to INVALCOLOR instead of zero. (Ben Jackson, closes vim/vim#1344) vim/vim@0cdb72a
* origin/master: (64 commits) patch 8.0.0150: completion for :filter does not skip the pattern patch 8.0.0149: :earlier does not work after reading the undo file patch 8.0.0148: wrong indent in C preprocessor with line continuation patch 8.0.0147: searchpair() fails when 'magic' is off patch 8.0.0146: termguicolors uses wrong colors on MS-Windows with ConEmu patch 8.0.0145: running tests on MS-Windows is noisy Only install coveralls when used. Better solution to make coveralls work again. Tune travis config for coverage with gcc only. Another attempt to make coveralls work. Attempt to make coverage working again. patch 8.0.0144: when using MSVC the GvimExt directory is cleaned twice patch 8.0.0143: line number of current buffer in getbufinfo() is wrong patch 8.0.0142 Problem: Normal colors are wrong with 'termguicolors'. Solution: Initialize to INVALCOLOR instead of zero. (Ben Jackson, closes vim#1344) Updated runtime files. patch 8.0.0141 Problem: Nested function test fails on AppVeyor. Solution: Disable the test on Windows for now. patch 8.0.0140 Problem: Pasting inserted text in Visual mode does not work properly. (Matthew Malcomson) Solution: Stop Visual mode before stuffing the inserted text. (Christian Brabandt, from neovim vim#5709) patch 8.0.0139 Problem: Warning for unused argument. Solution: Add UNUSED. patch 8.0.0138 Problem: Small build fails. Solution: Add #ifdef. patch 8.0.0137 Problem: When 'maxfuncdepth' is set above 200 the nesting is limited to 200. (Brett Stahlman) Solution: Allow for Ex command recursion depending on 'maxfuncdepth'. ...
The 'uninitialised' value for RGB values is
INVALCOLOR
, but new entries in thecterm_attr_table
were initialised to 0, meaning black.Fixes #1343
Testing
I have tested this fixes the reported issue, and I have run
make test
successfully. However I haven't done extensive regression testing and I have equally not written any new tests. The former I will do in parallel, the latter because I wasn't able to find an obvious way to test this as it pertains to what is put on the screen. If there are any suggestions, I'm happy to write tests.A final test (less canonical) was to install the
vim-solarized8
plugin and:set termguicolors
,:set cursorline
,:colorscheme solarized8_dark
, then:so $VIMRUNTIME/syntax/hitest.vim
. Before, a number of entries would randomly render in black, now they render correctly. It was using this colorscheme that I noticed the original issue.Otherwise, the repro steps on the attached issue can be used to verify.