aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/highlight.c4
-rw-r--r--src/nvim/version.c16
-rw-r--r--test/functional/api/highlight_spec.lua16
3 files changed, 26 insertions, 10 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));
}
}
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 4360b3776b..8bfd2f5021 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -101,7 +101,7 @@ static const int included_patches[] = {
1820,
1819,
1818,
- // 1817,
+ 1817,
1816,
1815,
1814,
@@ -132,7 +132,7 @@ static const int included_patches[] = {
// 1789,
1788,
1787,
- // 1786,
+ 1786,
1785,
1784,
// 1783,
@@ -378,9 +378,9 @@ static const int included_patches[] = {
// 1543,
1542,
1541,
- // 1540,
+ 1540,
1539,
- // 1538,
+ 1538,
1537,
1536,
1535,
@@ -396,7 +396,7 @@ static const int included_patches[] = {
// 1525,
1524,
1523,
- // 1522,
+ 1522,
1521,
// 1520,
1519,
@@ -423,11 +423,11 @@ static const int included_patches[] = {
1498,
1497,
1496,
- // 1495,
+ 1495,
1494,
1493,
1492,
- // 1491,
+ 1491,
1490,
1489,
1488,
@@ -562,7 +562,7 @@ static const int included_patches[] = {
1359,
// 1358,
1357,
- // 1356,
+ 1356,
// 1355,
// 1354,
1353,
diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua
index b6514a105c..a9d4c72d31 100644
--- a/test/functional/api/highlight_spec.lua
+++ b/test/functional/api/highlight_spec.lua
@@ -70,6 +70,22 @@ describe('API: highlight',function()
eq(false, err)
eq('Invalid highlight id: -1',
string.match(emsg, 'Invalid.*'))
+
+ -- Test highlight group without ctermbg value.
+ command('hi Normal ctermfg=red ctermbg=yellow')
+ command('hi NewConstant ctermfg=green guifg=white guibg=blue')
+ hl_id = eval("hlID('NewConstant')")
+ eq({foreground = 10,}, meths.get_hl_by_id(hl_id, false))
+
+ -- Test highlight group without ctermfg value.
+ command('hi clear NewConstant')
+ command('hi NewConstant ctermbg=Magenta guifg=white guibg=blue')
+ eq({background = 13,}, meths.get_hl_by_id(hl_id, false))
+
+ -- Test highlight group with ctermfg and ctermbg values.
+ command('hi clear NewConstant')
+ command('hi NewConstant ctermfg=green ctermbg=Magenta guifg=white guibg=blue')
+ eq({foreground = 10, background = 13,}, meths.get_hl_by_id(hl_id, false))
end)
it("nvim_get_hl_by_name", function()