diff options
author | kevinhwang91 <kevin.hwang@live.com> | 2020-01-08 22:19:23 +0800 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2020-01-08 06:19:23 -0800 |
commit | 831fa45ad84e2f41730db3350289e660006139d6 (patch) | |
tree | a5e2a633fd790580c097adf99a36f51a781c084c /src | |
parent | a91ea028303ea28a4667072d5db1ae10e8af80c9 (diff) | |
download | rneovim-831fa45ad84e2f41730db3350289e660006139d6.tar.gz rneovim-831fa45ad84e2f41730db3350289e660006139d6.tar.bz2 rneovim-831fa45ad84e2f41730db3350289e660006139d6.zip |
API: nvim_get_hl_by_id: omit hl instead of returning -1 #11685
Problem: When Normal highlight group defines ctermfg/bg, but other
highlight group lacks ctermfg/bg, nvim_get_hl_by_id(hl_id,
v:false) returns -1 for the missing ctermfg/bg instead of just
omitting it.
Solution: checking for -1 in hlattrs2dict()
fix #11680
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/highlight.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c index c96f07ed89..c0cae54572 100644 --- a/src/nvim/highlight.c +++ b/src/nvim/highlight.c @@ -642,11 +642,11 @@ Dictionary hlattrs2dict(HlAttrs ae, bool use_rgb) PUT(hl, "special", INTEGER_OBJ(ae.rgb_sp_color)); } } else { - if (cterm_normal_fg_color != ae.cterm_fg_color) { + if (cterm_normal_fg_color != ae.cterm_fg_color && ae.cterm_fg_color != 0) { PUT(hl, "foreground", INTEGER_OBJ(ae.cterm_fg_color - 1)); } - if (cterm_normal_bg_color != ae.cterm_bg_color) { + if (cterm_normal_bg_color != ae.cterm_bg_color && ae.cterm_bg_color != 0) { PUT(hl, "background", INTEGER_OBJ(ae.cterm_bg_color - 1)); } } |