From 59fed8bb6457eb6c5204dc39a49d7ea0e1781482 Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Tue, 18 Apr 2023 15:07:37 +0200 Subject: [PATCH] fix(api): extmark highlight groups not always included in details (#23179) Problem: Erroneous for loop condition. Solution: Remove for loop condition. --- src/nvim/api/extmark.c | 2 +- test/functional/api/extmark_spec.lua | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c index fc17b9d0cc..eb49587d03 100644 --- a/src/nvim/api/extmark.c +++ b/src/nvim/api/extmark.c @@ -208,7 +208,7 @@ static Array extmark_to_array(const ExtmarkInfo *extmark, bool id, bool add_dict // uncrustify:on - for (int j = 0; hls[j].name && hls[j].val; j++) { + for (int j = 0; hls[j].name; j++) { if (hls[j].val) { PUT(dict, hls[j].name, hl_group_name(hls[j].val, hl_name)); } diff --git a/test/functional/api/extmark_spec.lua b/test/functional/api/extmark_spec.lua index 4bd8f51904..e30ffc92b6 100644 --- a/test/functional/api/extmark_spec.lua +++ b/test/functional/api/extmark_spec.lua @@ -1541,6 +1541,12 @@ describe('API/extmarks', function() virt_text_pos = "win_col", virt_text_win_col = 1, } }, get_extmark_by_id(ns, marks[2], { details = true })) + set_extmark(ns, marks[3], 0, 0, { cursorline_hl_group = "Statement" }) + eq({0, 0, { + ns_id = 1, + cursorline_hl_group = "Statement", + right_gravity = true, + } }, get_extmark_by_id(ns, marks[3], { details = true })) end) it('can get marks from anonymous namespaces', function()