mirror of
https://github.com/neovim/neovim.git
synced 2025-10-01 15:38:33 +00:00
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
This commit is contained in:

committed by
Justin M. Keyes

parent
a91ea02830
commit
831fa45ad8
@@ -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));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user