From 860fea1a3f880c2da0ac351a9523156bcfc67361 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 31 Jan 2023 07:08:23 +0800 Subject: fix(highlight): properly deal with underline mask when listing (#22057) --- src/nvim/highlight_group.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 5b1ea9967d..3d91335f55 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1553,12 +1553,17 @@ static bool highlight_list_arg(const int id, bool didh, const int type, int iarg } else { // type == LIST_ATTR buf[0] = NUL; for (int i = 0; hl_attr_table[i] != 0; i++) { - if (iarg & hl_attr_table[i]) { + if (((hl_attr_table[i] & HL_UNDERLINE_MASK) + && ((iarg & HL_UNDERLINE_MASK) == hl_attr_table[i])) + || (!(hl_attr_table[i] & HL_UNDERLINE_MASK) + && (iarg & hl_attr_table[i]))) { if (buf[0] != NUL) { xstrlcat(buf, ",", 100); } xstrlcat(buf, hl_name_table[i], 100); - iarg &= ~hl_attr_table[i]; // don't want "inverse" + if (!(hl_attr_table[i] & HL_UNDERLINE_MASK)) { + iarg &= ~hl_attr_table[i]; // don't want "inverse" + } } } } -- cgit From 4be6c6cf0ddf5e31d4103cb5df06651ba6f4897b Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sat, 11 Feb 2023 11:05:57 +0100 Subject: refactor: replace char_u with char (#21901) refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459 --- src/nvim/highlight_group.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 3d91335f55..e34c13abc1 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1522,7 +1522,7 @@ Dictionary get_global_hl_defs(Arena *arena) char *link = hl_table[h->sg_link - 1].sg_name; PUT_C(attrs, "link", STRING_OBJ(cstr_as_string(link))); } - PUT_C(rv, (char *)h->sg_name, DICTIONARY_OBJ(attrs)); + PUT_C(rv, h->sg_name, DICTIONARY_OBJ(attrs)); } return rv; @@ -1547,7 +1547,7 @@ static bool highlight_list_arg(const int id, bool didh, const int type, int iarg char buf[100]; const char *ts = buf; if (type == LIST_INT) { - snprintf((char *)buf, sizeof(buf), "%d", iarg - 1); + snprintf(buf, sizeof(buf), "%d", iarg - 1); } else if (type == LIST_STRING) { ts = sarg; } else { // type == LIST_ATTR -- cgit From 524e1a06432ed7a88c1e183d81812dd48dc18cfb Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 23 Feb 2023 16:15:04 +0800 Subject: fix(highlight): avoid ORing underline flags (#22372) When combining attributes use the one that takes priority. For :highlight command use the last one specified. For API use a hard-coded order same as the order in docs. --- src/nvim/highlight_group.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index e34c13abc1..d2f5b60dc6 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1124,6 +1124,9 @@ void do_highlight(const char *line, const bool forceit, const bool init) for (i = ARRAY_SIZE(hl_attr_table); --i >= 0;) { int len = (int)strlen(hl_name_table[i]); if (STRNICMP(arg + off, hl_name_table[i], len) == 0) { + if (hl_attr_table[i] & HL_UNDERLINE_MASK) { + attr &= ~HL_UNDERLINE_MASK; + } attr |= hl_attr_table[i]; off += len; break; -- cgit From 1cc23e1109ed88275df5c986c352f73b99a0301c Mon Sep 17 00:00:00 2001 From: swarn Date: Mon, 6 Mar 2023 12:03:13 -0600 Subject: feat(lsp)!: add rule-based sem token highlighting (#22022) feat(lsp)!: change semantic token highlighting Change the default highlights used, and add more highlights per token. Add an LspTokenUpdate event and a highlight_token function. :Inspect now shows any highlights applied by token highlighting rules, default or user-defined. BREAKING CHANGE: change the default highlight groups used by semantic token highlighting. --- src/nvim/highlight_group.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index d2f5b60dc6..70ee6c757c 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -270,16 +270,22 @@ static const char *highlight_init_both[] = { "default link @tag Tag", // LSP semantic tokens - "default link @class Structure", - "default link @struct Structure", - "default link @enum Type", - "default link @enumMember Constant", - "default link @event Identifier", - "default link @interface Identifier", - "default link @modifier Identifier", - "default link @regexp SpecialChar", - "default link @typeParameter Type", - "default link @decorator Identifier", + "default link @lsp.type.class Structure", + "default link @lsp.type.decorator Function", + "default link @lsp.type.enum Structure", + "default link @lsp.type.enumMember Constant", + "default link @lsp.type.function Function", + "default link @lsp.type.interface Structure", + "default link @lsp.type.macro Macro", + "default link @lsp.type.method Function", + "default link @lsp.type.namespace Structure", + "default link @lsp.type.parameter Identifier", + "default link @lsp.type.property Identifier", + "default link @lsp.type.struct Structure", + "default link @lsp.type.type Type", + "default link @lsp.type.typeParameter TypeDef", + "default link @lsp.type.variable Identifier", + NULL }; -- cgit From 8cb5b995b6e4d86035e6950d92c0c68ab4e46787 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 11 Mar 2023 10:05:47 +0800 Subject: vim-patch:9.0.1397: highlight for popupmenu kind and extra cannot be set (#22619) Problem: Highlight for popupmenu kind and extra cannot be set. Solution: Add PmenuKind, PmenuKindSel, PmenuExtra and PmenuExtraSel highlight groups and use them. (Gianmaria Bajo, closes vim/vim#12114) https://github.com/vim/vim/commit/6a7c7749204b256e779c245b1e999bf852ad7b64 Co-authored-by: Gianmaria Bajo --- src/nvim/highlight_group.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 70ee6c757c..5d8649b429 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -150,6 +150,10 @@ static const char *highlight_init_both[] = { "default link QuickFixLine Search", "default link CursorLineSign SignColumn", "default link CursorLineFold FoldColumn", + "default link PmenuKind Pmenu", + "default link PmenuKindSel PmenuSel", + "default link PmenuExtra Pmenu", + "default link PmenuExtraSel PmenuSel", "default link Substitute Search", "default link Whitespace NonText", "default link MsgSeparator StatusLine", -- cgit From c0fe6c040e19ef9102a8507ffcbd88b83186326a Mon Sep 17 00:00:00 2001 From: Null Chilly <56817415+nullchilly@users.noreply.github.com> Date: Thu, 23 Mar 2023 16:31:39 +0700 Subject: feat(api): add nvim_get_hl (#22693) Problem: no way of getting all highlight group definitions in a namespace. Solution: add `nvim_get_hl()`, deprecate `nvim_get_hl_by_name()` and `nvim_get_hl_by_id()`. --- src/nvim/highlight_group.c | 68 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 58 insertions(+), 10 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 5d8649b429..96b55b5abb 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -12,6 +12,7 @@ #include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" +#include "nvim/api/private/validate.h" #include "nvim/ascii.h" #include "nvim/autocmd.h" #include "nvim/buffer_defs.h" @@ -1521,24 +1522,71 @@ static void highlight_list_one(const int id) } } -Dictionary get_global_hl_defs(Arena *arena) +static bool hlgroup2dict(Dictionary *hl, NS ns_id, int hl_id, Arena *arena) { + HlGroup *sgp = &hl_table[hl_id - 1]; + int link = ns_id == 0 ? sgp->sg_link : ns_get_hl(&ns_id, hl_id, true, sgp->sg_set); + if (link == -1) { + return false; + } + HlAttrs attr = + syn_attr2entry(ns_id == 0 ? sgp->sg_attr : ns_get_hl(&ns_id, hl_id, false, sgp->sg_set)); + if (link > 0) { + *hl = arena_dict(arena, 1); + PUT_C(*hl, "link", STRING_OBJ(cstr_as_string(hl_table[link - 1].sg_name))); + } else { + *hl = arena_dict(arena, HLATTRS_DICT_SIZE); + hlattrs2dict(hl, attr, true, true); + hlattrs2dict(hl, attr, false, true); + } + return true; +} + +Dictionary ns_get_hl_defs(NS ns_id, Dict(get_highlight) *opts, Arena *arena, Error *err) +{ + Boolean link = api_object_to_bool(opts->link, "link", true, err); + int id = -1; + if (opts->name.type != kObjectTypeNil) { + VALIDATE_T("highlight name", kObjectTypeString, opts->name.type, { + goto cleanup; + }); + String name = opts->name.data.string; + id = syn_check_group(name.data, name.size); + } else if (opts->id.type != kObjectTypeNil) { + VALIDATE_T("highlight id", kObjectTypeInteger, opts->id.type, { + goto cleanup; + }); + id = (int)opts->id.data.integer; + } + + if (id != -1) { + VALIDATE(1 <= id && id <= highlight_ga.ga_len, "%s", "Highlight id out of bounds", { + goto cleanup; + }); + Dictionary attrs = ARRAY_DICT_INIT; + hlgroup2dict(&attrs, ns_id, link ? id : syn_get_final_id(id), arena); + return attrs; + } + if (ERROR_SET(err)) { + goto cleanup; + } + Dictionary rv = arena_dict(arena, (size_t)highlight_ga.ga_len); for (int i = 1; i <= highlight_ga.ga_len; i++) { Dictionary attrs = ARRAY_DICT_INIT; - HlGroup *h = &hl_table[i - 1]; - if (h->sg_attr > 0) { - attrs = arena_dict(arena, HLATTRS_DICT_SIZE); - hlattrs2dict(&attrs, syn_attr2entry(h->sg_attr), true); - } else if (h->sg_link > 0) { - attrs = arena_dict(arena, 1); - char *link = hl_table[h->sg_link - 1].sg_name; - PUT_C(attrs, "link", STRING_OBJ(cstr_as_string(link))); + if (!hlgroup2dict(&attrs, ns_id, i, arena)) { + continue; } - PUT_C(rv, h->sg_name, DICTIONARY_OBJ(attrs)); + PUT_C(rv, hl_table[(link ? i : syn_get_final_id(i)) - 1].sg_name, DICTIONARY_OBJ(attrs)); } return rv; + +cleanup: + api_free_integer(id); + api_free_boolean(link); + Dictionary empty = ARRAY_DICT_INIT; + return empty; } /// Outputs a highlight when doing ":hi MyHighlight" -- cgit From 6d267ad30cf539f520b46e3c92939f7031ce116f Mon Sep 17 00:00:00 2001 From: bfredl Date: Thu, 23 Mar 2023 12:44:05 +0100 Subject: fix(api): make nvim_get_hl return 'cterm' attrs properly --- src/nvim/highlight_group.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 96b55b5abb..38af2a708a 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1536,8 +1536,12 @@ static bool hlgroup2dict(Dictionary *hl, NS ns_id, int hl_id, Arena *arena) PUT_C(*hl, "link", STRING_OBJ(cstr_as_string(hl_table[link - 1].sg_name))); } else { *hl = arena_dict(arena, HLATTRS_DICT_SIZE); - hlattrs2dict(hl, attr, true, true); - hlattrs2dict(hl, attr, false, true); + Dictionary hl_cterm = arena_dict(arena, HLATTRS_DICT_SIZE); + hlattrs2dict(hl, NULL, attr, true, true); + hlattrs2dict(hl, &hl_cterm, attr, false, true); + if (kv_size(hl_cterm)) { + PUT_C(*hl, "cterm", DICTIONARY_OBJ(hl_cterm)); + } } return true; } -- cgit From 226a6c3eaef2a7220841d3d5e69e1baf543b3d6f Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Thu, 30 Mar 2023 14:49:58 +0100 Subject: feat(diagnostic): add support for tags The LSP spec supports two tags that can be added to diagnostics: unnecessary and deprecated. Extend vim.diagnostic to be able to handle these. --- src/nvim/highlight_group.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 38af2a708a..057447c9f4 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -218,6 +218,8 @@ static const char *highlight_init_both[] = { "default link DiagnosticSignInfo DiagnosticInfo", "default link DiagnosticSignHint DiagnosticHint", "default link DiagnosticSignOk DiagnosticOk", + "default DiagnosticDeprecated cterm=strikethrough gui=strikethrough guisp=Red", + "default link DiagnosticUnnecessary Comment", // Text "default link @text.literal Comment", -- cgit From b34097fe6d2ea5c84bcec65a834a430d9f58eb64 Mon Sep 17 00:00:00 2001 From: "Sindre T. Strøm" Date: Fri, 31 Mar 2023 12:52:53 +0200 Subject: fix(api): return both link and attributes with nvim_get_hl (#22824) Problem: No way to get the actual highlight attributes for a linked group through |nvim_get_hl()| (not the attributes from the link target). Solution: Return the actual attributes as well as the link target name. --- src/nvim/highlight_group.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 057447c9f4..56fa206247 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -797,9 +797,9 @@ void set_hl_group(int id, HlAttrs attrs, Dict(highlight) *dict, int link_id) } HlGroup *g = &hl_table[idx]; + g->sg_cleared = false; if (link_id > 0) { - g->sg_cleared = false; g->sg_link = link_id; g->sg_script_ctx = current_sctx; g->sg_script_ctx.sc_lnum += SOURCING_LNUM; @@ -809,11 +809,10 @@ void set_hl_group(int id, HlAttrs attrs, Dict(highlight) *dict, int link_id) g->sg_deflink_sctx = current_sctx; g->sg_deflink_sctx.sc_lnum += SOURCING_LNUM; } - goto update; + } else { + g->sg_link = 0; } - g->sg_cleared = false; - g->sg_link = 0; g->sg_gui = attrs.rgb_ae_attr; g->sg_rgb_fg = attrs.rgb_fg_color; @@ -865,7 +864,6 @@ void set_hl_group(int id, HlAttrs attrs, Dict(highlight) *dict, int link_id) } } -update: if (!updating_screen) { redraw_all_later(UPD_NOT_VALID); } @@ -1533,17 +1531,15 @@ static bool hlgroup2dict(Dictionary *hl, NS ns_id, int hl_id, Arena *arena) } HlAttrs attr = syn_attr2entry(ns_id == 0 ? sgp->sg_attr : ns_get_hl(&ns_id, hl_id, false, sgp->sg_set)); + *hl = arena_dict(arena, HLATTRS_DICT_SIZE + 1); if (link > 0) { - *hl = arena_dict(arena, 1); PUT_C(*hl, "link", STRING_OBJ(cstr_as_string(hl_table[link - 1].sg_name))); - } else { - *hl = arena_dict(arena, HLATTRS_DICT_SIZE); - Dictionary hl_cterm = arena_dict(arena, HLATTRS_DICT_SIZE); - hlattrs2dict(hl, NULL, attr, true, true); - hlattrs2dict(hl, &hl_cterm, attr, false, true); - if (kv_size(hl_cterm)) { - PUT_C(*hl, "cterm", DICTIONARY_OBJ(hl_cterm)); - } + } + Dictionary hl_cterm = arena_dict(arena, HLATTRS_DICT_SIZE); + hlattrs2dict(hl, NULL, attr, true, true); + hlattrs2dict(hl, &hl_cterm, attr, false, true); + if (kv_size(hl_cterm)) { + PUT_C(*hl, "cterm", DICTIONARY_OBJ(hl_cterm)); } return true; } -- cgit From d5f6176e6dc4b4e12fc5061ca6e87f4af533e46a Mon Sep 17 00:00:00 2001 From: ii14 <59243201+ii14@users.noreply.github.com> Date: Sat, 1 Apr 2023 02:49:51 +0200 Subject: refactor: add const and remove unnecessary casts (#22841) --- src/nvim/highlight_group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 56fa206247..cce124de77 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1631,7 +1631,7 @@ static bool highlight_list_arg(const int id, bool didh, const int type, int iarg } } - (void)syn_list_header(didh, vim_strsize((char *)ts) + (int)strlen(name) + 1, id, false); + (void)syn_list_header(didh, vim_strsize(ts) + (int)strlen(name) + 1, id, false); didh = true; if (!got_int) { if (*name != NUL) { -- cgit From b479e3a95d9ce6557c3fc349e08701ea5b702777 Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Tue, 4 Apr 2023 14:06:58 -0600 Subject: feat(lsp): create default link from @lsp.type.comment to Comment (#22888) --- src/nvim/highlight_group.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index cce124de77..a954c14924 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -278,6 +278,7 @@ static const char *highlight_init_both[] = { // LSP semantic tokens "default link @lsp.type.class Structure", + "default link @lsp.type.comment Comment", "default link @lsp.type.decorator Function", "default link @lsp.type.enum Structure", "default link @lsp.type.enumMember Constant", -- cgit From 0f42aa1f2a860ce6d72a825b397fe09c875613b5 Mon Sep 17 00:00:00 2001 From: bfredl Date: Thu, 6 Apr 2023 10:03:37 +0200 Subject: fix(highlight): use winhl=Foo:Bar even when Bar is empty fixes #22906 --- src/nvim/highlight_group.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index a954c14924..5d9148e992 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1988,18 +1988,23 @@ static int syn_add_group(const char *name, size_t len) /// @see syn_attr2entry int syn_id2attr(int hl_id) { - return syn_ns_id2attr(-1, hl_id, false); + bool optional = false; + return syn_ns_id2attr(-1, hl_id, &optional); } -int syn_ns_id2attr(int ns_id, int hl_id, bool optional) +int syn_ns_id2attr(int ns_id, int hl_id, bool *optional) + FUNC_ATTR_NONNULL_ALL { - hl_id = syn_ns_get_final_id(&ns_id, hl_id); + if (syn_ns_get_final_id(&ns_id, &hl_id)) { + // If the namespace explicitly defines a group to be empty, it is not optional + *optional = false; + } HlGroup *sgp = &hl_table[hl_id - 1]; // index is ID minus one int attr = ns_get_hl(&ns_id, hl_id, false, sgp->sg_set); // if a highlight group is optional, don't use the global value - if (attr >= 0 || (optional && ns_id > 0)) { + if (attr >= 0 || (*optional && ns_id > 0)) { return attr; } return sgp->sg_attr; @@ -2008,16 +2013,20 @@ int syn_ns_id2attr(int ns_id, int hl_id, bool optional) /// Translate a group ID to the final group ID (following links). int syn_get_final_id(int hl_id) { - int id = curwin->w_ns_hl_active; - return syn_ns_get_final_id(&id, hl_id); + int ns_id = curwin->w_ns_hl_active; + syn_ns_get_final_id(&ns_id, &hl_id); + return hl_id; } -int syn_ns_get_final_id(int *ns_id, int hl_id) +bool syn_ns_get_final_id(int *ns_id, int *hl_idp) { int count; + int hl_id = *hl_idp; + bool used = false; if (hl_id > highlight_ga.ga_len || hl_id < 1) { - return 0; // Can be called from eval!! + *hl_idp = 0; + return false; // Can be called from eval!! } // Follow links until there is no more. @@ -2030,8 +2039,10 @@ int syn_ns_get_final_id(int *ns_id, int hl_id) // syn_id2attr time int check = ns_get_hl(ns_id, hl_id, true, sgp->sg_set); if (check == 0) { - return hl_id; // how dare! it broke the link! + *hl_idp = hl_id; + return true; // how dare! it broke the link! } else if (check > 0) { + used = true; hl_id = check; continue; } @@ -2045,7 +2056,8 @@ int syn_ns_get_final_id(int *ns_id, int hl_id) } } - return hl_id; + *hl_idp = hl_id; + return used; } /// Refresh the color attributes of all highlight groups. @@ -2128,7 +2140,8 @@ void highlight_changed(void) abort(); } int ns_id = -1; - int final_id = syn_ns_get_final_id(&ns_id, id); + int final_id = id; + syn_ns_get_final_id(&ns_id, &final_id); if (hlf == HLF_SNC) { id_SNC = final_id; } else if (hlf == HLF_S) { -- cgit From 1d2a29f75ba7d094c8e7444c9b249a4a7211c93c Mon Sep 17 00:00:00 2001 From: ii14 <59243201+ii14@users.noreply.github.com> Date: Fri, 7 Apr 2023 19:39:04 +0200 Subject: refactor: make char * parameters const in message.c Add const to char * parameters in message.c functions and remove some redundant casts. --- src/nvim/highlight_group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 5d9148e992..bc0f783095 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1639,7 +1639,7 @@ static bool highlight_list_arg(const int id, bool didh, const int type, int iarg msg_puts_attr(name, HL_ATTR(HLF_D)); msg_puts_attr("=", HL_ATTR(HLF_D)); } - msg_outtrans((char *)ts); + msg_outtrans(ts); } return didh; } -- cgit From 9408f2dcf7cade2631688300e9b58eed6bc5219a Mon Sep 17 00:00:00 2001 From: ii14 <59243201+ii14@users.noreply.github.com> Date: Fri, 7 Apr 2023 19:40:57 +0200 Subject: refactor: remove redundant const char * casts --- src/nvim/highlight_group.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index bc0f783095..0acf1989c3 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -895,15 +895,15 @@ void do_highlight(const char *line, const bool forceit, const bool init) bool dodefault = false; // Isolate the name. - const char *name_end = (const char *)skiptowhite(line); - const char *linep = (const char *)skipwhite(name_end); + const char *name_end = skiptowhite(line); + const char *linep = skipwhite(name_end); // Check for "default" argument. if (strncmp(line, "default", (size_t)(name_end - line)) == 0) { dodefault = true; line = linep; - name_end = (const char *)skiptowhite(line); - linep = (const char *)skipwhite(name_end); + name_end = skiptowhite(line); + linep = skipwhite(name_end); } bool doclear = false; @@ -937,9 +937,9 @@ void do_highlight(const char *line, const bool forceit, const bool init) int to_id; HlGroup *hlgroup = NULL; - from_end = (const char *)skiptowhite(from_start); - to_start = (const char *)skipwhite(from_end); - to_end = (const char *)skiptowhite(to_start); + from_end = skiptowhite(from_start); + to_start = skipwhite(from_end); + to_end = skiptowhite(to_start); if (ends_excmd((uint8_t)(*from_start)) || ends_excmd((uint8_t)(*to_start))) { @@ -1015,8 +1015,8 @@ void do_highlight(const char *line, const bool forceit, const bool init) redraw_all_later(UPD_NOT_VALID); return; } - name_end = (const char *)skiptowhite(line); - linep = (const char *)skipwhite(name_end); + name_end = skiptowhite(line); + linep = skipwhite(name_end); } // Find the group name in the table. If it does not exist yet, add it. @@ -1073,7 +1073,7 @@ void do_highlight(const char *line, const bool forceit, const bool init) memcpy(key, key_start, key_len); key[key_len] = NUL; vim_strup(key); - linep = (const char *)skipwhite(linep); + linep = skipwhite(linep); if (strcmp(key, "NONE") == 0) { if (!init || hl_table[idx].sg_set == 0) { @@ -1094,7 +1094,7 @@ void do_highlight(const char *line, const bool forceit, const bool init) linep++; // Isolate the argument. - linep = (const char *)skipwhite(linep); + linep = skipwhite(linep); if (*linep == '\'') { // guifg='color name' arg_start = ++linep; linep = strchr(linep, '\''); @@ -1105,7 +1105,7 @@ void do_highlight(const char *line, const bool forceit, const bool init) } } else { arg_start = linep; - linep = (const char *)skiptowhite(linep); + linep = skiptowhite(linep); } if (linep == arg_start) { semsg(_("E417: missing argument: %s"), key_start); @@ -1361,7 +1361,7 @@ void do_highlight(const char *line, const bool forceit, const bool init) } // Continue with next argument. - linep = (const char *)skipwhite(linep); + linep = skipwhite(linep); } } @@ -2211,7 +2211,7 @@ void set_context_in_highlight_cmd(expand_T *xp, const char *arg) } // (part of) subcommand already typed - const char *p = (const char *)skiptowhite(arg); + const char *p = skiptowhite(arg); if (*p == NUL) { return; } @@ -2219,9 +2219,9 @@ void set_context_in_highlight_cmd(expand_T *xp, const char *arg) // past "default" or group name include_default = 0; if (strncmp("default", arg, (unsigned)(p - arg)) == 0) { - arg = (const char *)skipwhite(p); + arg = skipwhite(p); xp->xp_pattern = (char *)arg; - p = (const char *)skiptowhite(arg); + p = skiptowhite(arg); } if (*p == NUL) { return; @@ -2235,10 +2235,10 @@ void set_context_in_highlight_cmd(expand_T *xp, const char *arg) if (strncmp("link", arg, (unsigned)(p - arg)) == 0 || strncmp("clear", arg, (unsigned)(p - arg)) == 0) { xp->xp_pattern = skipwhite(p); - p = (const char *)skiptowhite(xp->xp_pattern); + p = skiptowhite(xp->xp_pattern); if (*p != NUL) { // past first group name xp->xp_pattern = skipwhite(p); - p = (const char *)skiptowhite(xp->xp_pattern); + p = skiptowhite(xp->xp_pattern); } } if (*p != NUL) { // past group name(s) @@ -2301,7 +2301,7 @@ const char *get_highlight_name_ext(expand_T *xp, int idx, bool skip_cleared) } else if (idx >= highlight_ga.ga_len) { return NULL; } - return (const char *)hl_table[idx].sg_name; + return hl_table[idx].sg_name; } color_name_table_T color_name_table[] = { -- cgit From 04933b1ea968f958d2541dd65fd33ebb503caac3 Mon Sep 17 00:00:00 2001 From: ii14 <59243201+ii14@users.noreply.github.com> Date: Fri, 7 Apr 2023 21:08:16 +0200 Subject: refactor: remove redundant casts --- src/nvim/highlight_group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 0acf1989c3..d971110d9d 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -3002,7 +3002,7 @@ RgbValue name_to_color(const char *name, int *idx) && isxdigit((uint8_t)name[6]) && name[7] == NUL) { // rgb hex string *idx = kColorIdxHex; - return (RgbValue)strtol((char *)(name + 1), NULL, 16); + return (RgbValue)strtol(name + 1, NULL, 16); } else if (!STRICMP(name, "bg") || !STRICMP(name, "background")) { *idx = kColorIdxBg; return normal_bg; -- cgit From 4ce0ada0d4c8c57a181ab08717a3d052d46ae158 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 8 Apr 2023 16:57:47 +0800 Subject: fix(highlight): add missing g: prefix for colors_name (#22952) Fix #22951. This was fixed in Vim in patch 8.2.0613. --- src/nvim/highlight_group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index d971110d9d..6493408a58 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1003,7 +1003,7 @@ void do_highlight(const char *line, const bool forceit, const bool init) // ":highlight clear [group]" command. line = linep; if (ends_excmd((uint8_t)(*line))) { - do_unlet(S_LEN("colors_name"), true); + do_unlet(S_LEN("g:colors_name"), true); restore_cterm_colors(); // Clear all default highlight groups and load the defaults. -- cgit From d05d63a18ff8394b31b3f3b85bfaebe2af358437 Mon Sep 17 00:00:00 2001 From: bfredl Date: Thu, 13 Apr 2023 14:08:36 +0200 Subject: fix(api): make nvim_get_hl not return non-existing groups fixes #23063 --- src/nvim/highlight_group.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 6493408a58..3ab8a3bb88 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1530,6 +1530,10 @@ static bool hlgroup2dict(Dictionary *hl, NS ns_id, int hl_id, Arena *arena) if (link == -1) { return false; } + if (ns_id == 0 && sgp->sg_cleared && sgp->sg_set == 0) { + // table entry was created but not ever set + return false; + } HlAttrs attr = syn_attr2entry(ns_id == 0 ? sgp->sg_attr : ns_get_hl(&ns_id, hl_id, false, sgp->sg_set)); *hl = arena_dict(arena, HLATTRS_DICT_SIZE + 1); -- cgit From 88cfb49bee3c9102082c7010acb92244e4ad1348 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 5 May 2023 07:14:39 +0800 Subject: vim-patch:8.2.4890: inconsistent capitalization in error messages Problem: Inconsistent capitalization in error messages. Solution: Make capitalization consistent. (Doug Kearns) https://github.com/vim/vim/commit/cf030578b26460643dca4a40e7f2e3bc19c749aa Co-authored-by: Bram Moolenaar --- src/nvim/highlight_group.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 3ab8a3bb88..a0f0a947b8 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -119,6 +119,17 @@ enum { # include "highlight_group.c.generated.h" #endif +static const char e_highlight_group_name_not_found_str[] + = N_("E411: Highlight group not found: %s"); +static const char e_group_has_settings_highlight_link_ignored[] + = N_("E414: Group has settings, highlight link ignored"); +static const char e_unexpected_equal_sign_str[] + = N_("E415: Unexpected equal sign: %s"); +static const char e_missing_equal_sign_str_2[] + = N_("E416: Missing equal sign: %s"); +static const char e_missing_argument_str[] + = N_("E417: Missing argument: %s"); + #define hl_table ((HlGroup *)((highlight_ga.ga_data))) // The default highlight groups. These are compiled-in for fast startup and @@ -920,7 +931,7 @@ void do_highlight(const char *line, const bool forceit, const bool init) if (!doclear && !dolink && ends_excmd((uint8_t)(*linep))) { int id = syn_name2id_len(line, (size_t)(name_end - line)); if (id == 0) { - semsg(_("E411: highlight group not found: %s"), line); + semsg(_(e_highlight_group_name_not_found_str), line); } else { highlight_list_one(id); } @@ -976,7 +987,7 @@ void do_highlight(const char *line, const bool forceit, const bool init) if (to_id > 0 && !forceit && !init && hl_has_settings(from_id - 1, dodefault)) { if (SOURCING_NAME == NULL && !dodefault) { - emsg(_("E414: group has settings, highlight link ignored")); + emsg(_(e_group_has_settings_highlight_link_ignored)); } } else if (hlgroup->sg_link != to_id || hlgroup->sg_script_ctx.sc_sid != current_sctx.sc_sid @@ -1054,7 +1065,7 @@ void do_highlight(const char *line, const bool forceit, const bool init) while (!ends_excmd((uint8_t)(*linep))) { const char *key_start = linep; if (*linep == '=') { - semsg(_("E415: unexpected equal sign: %s"), key_start); + semsg(_(e_unexpected_equal_sign_str), key_start); error = true; break; } @@ -1087,7 +1098,7 @@ void do_highlight(const char *line, const bool forceit, const bool init) // Check for the equal sign. if (*linep != '=') { - semsg(_("E416: missing equal sign: %s"), key_start); + semsg(_(e_missing_equal_sign_str_2), key_start); error = true; break; } @@ -1108,7 +1119,7 @@ void do_highlight(const char *line, const bool forceit, const bool init) linep = skiptowhite(linep); } if (linep == arg_start) { - semsg(_("E417: missing argument: %s"), key_start); + semsg(_(e_missing_argument_str), key_start); error = true; break; } -- cgit From e2fdd53d8c015913e8be4ff708fc3488558c8906 Mon Sep 17 00:00:00 2001 From: bfredl Date: Sun, 14 May 2023 18:45:56 +0200 Subject: refactor(map): avoid duplicated khash_t types for values This reduces the total number of khash_t instantiations from 22 to 8. Make the khash internal functions take the size of values as a runtime parameter. This is abstracted with typesafe Map containers which are still specialized for both key, value type. Introduce `Set(key)` type for when there is no value. Refactor shada.c to use Map/Set instead of khash directly. This requires `map_ref` operation to be more flexible. Return pointers to both key and value, plus an indicator for new_item. As a bonus, `map_key` is now redundant. Instead of Map(cstr_t, FileMarks), use a pointer map as the FileMarks struct is humongous. Make `event_strings` actually work like an intern pool instead of wtf it was doing before. --- src/nvim/highlight_group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index a0f0a947b8..41e7bdb7ac 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1420,7 +1420,7 @@ void do_highlight(const char *line, const bool forceit, const bool init) void free_highlight(void) { ga_clear(&highlight_ga); - map_destroy(cstr_t, int)(&highlight_unames); + map_destroy(cstr_t, &highlight_unames); arena_mem_free(arena_finish(&highlight_arena)); } -- cgit From b7708eac24c22a96676176c68569d6859a9f793f Mon Sep 17 00:00:00 2001 From: Null Chilly <56817415+nullchilly@users.noreply.github.com> Date: Mon, 22 May 2023 15:49:01 +0700 Subject: fix(api): nvim_get_hl should return default flag --- src/nvim/highlight_group.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 41e7bdb7ac..6965c53f59 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1548,6 +1548,9 @@ static bool hlgroup2dict(Dictionary *hl, NS ns_id, int hl_id, Arena *arena) HlAttrs attr = syn_attr2entry(ns_id == 0 ? sgp->sg_attr : ns_get_hl(&ns_id, hl_id, false, sgp->sg_set)); *hl = arena_dict(arena, HLATTRS_DICT_SIZE + 1); + if (attr.rgb_ae_attr & HL_DEFAULT) { + PUT_C(*hl, "default", BOOLEAN_OBJ(true)); + } if (link > 0) { PUT_C(*hl, "link", STRING_OBJ(cstr_as_string(hl_table[link - 1].sg_name))); } -- cgit From 62e0e0349c00c2c1fa1e5ec09aa7028f12ed329b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 23 May 2023 16:12:16 +0800 Subject: fix(colorscheme): try .lua files in 'rtp' before .vim files in 'pp' (#23727) This ensures that colorschemes in 'rtp' are tried before ones in 'pp', because some colorschemes in 'pp' may not work if not added to 'rtp'. This also match the current documentation better. --- src/nvim/highlight_group.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 6965c53f59..a17fe2fc8c 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -697,10 +697,18 @@ int load_colors(char *name) char *buf = xmalloc(buflen); apply_autocmds(EVENT_COLORSCHEMEPRE, name, curbuf->b_fname, false, curbuf); snprintf(buf, buflen, "colors/%s.vim", name); - int retval = source_runtime(buf, DIP_START + DIP_OPT); + int retval = source_runtime(buf, 0); if (retval == FAIL) { snprintf(buf, buflen, "colors/%s.lua", name); - retval = source_runtime(buf, DIP_START + DIP_OPT); + retval = source_runtime(buf, 0); + } + if (retval == FAIL) { + snprintf(buf, buflen, "colors/%s.vim", name); + retval = source_runtime(buf, DIP_NORTP + DIP_START + DIP_OPT); + } + if (retval == FAIL) { + snprintf(buf, buflen, "colors/%s.lua", name); + retval = source_runtime(buf, DIP_NORTP + DIP_START + DIP_OPT); } xfree(buf); if (retval == OK) { -- cgit From cfd4fdfea4d0e68ea50ad412b88b5289ded6fd6f Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Tue, 23 May 2023 14:25:10 +0600 Subject: refactor(api): new helper macros Adds new API helper macros `CSTR_AS_OBJ()`, `STATIC_CSTR_AS_OBJ()`, and `STATIC_CSTR_TO_OBJ()`, which cleans up a lot of the current code. These macros will also be used extensively in the upcoming option refactor PRs because then API Objects will be used to get/set options. This PR also modifies pre-existing code to use old API helper macros like `CSTR_TO_OBJ()` to make them cleaner. --- src/nvim/highlight_group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 41e7bdb7ac..d1c04afe2c 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1549,7 +1549,7 @@ static bool hlgroup2dict(Dictionary *hl, NS ns_id, int hl_id, Arena *arena) syn_attr2entry(ns_id == 0 ? sgp->sg_attr : ns_get_hl(&ns_id, hl_id, false, sgp->sg_set)); *hl = arena_dict(arena, HLATTRS_DICT_SIZE + 1); if (link > 0) { - PUT_C(*hl, "link", STRING_OBJ(cstr_as_string(hl_table[link - 1].sg_name))); + PUT_C(*hl, "link", CSTR_AS_OBJ(hl_table[link - 1].sg_name)); } Dictionary hl_cterm = arena_dict(arena, HLATTRS_DICT_SIZE); hlattrs2dict(hl, NULL, attr, true, true); -- cgit From b3d5138fd0066fda26ef7724a542ae45eb42fc84 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Wed, 7 Jun 2023 06:05:16 +0600 Subject: refactor(options): remove `getoption_T` and introduce `OptVal` (#23850) Removes the `getoption_T` struct and also introduces the `OptVal` struct to unify the methods of getting/setting different option value types. This is the first of many PRs to reduce code duplication in the Vim option code as well as to make options easier to maintain. It also increases the flexibility and extensibility of options. Which opens the door for things like Array and Dictionary options. --- src/nvim/highlight_group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 09e7d04e02..48e4479c58 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1280,7 +1280,7 @@ void do_highlight(const char *line, const bool forceit, const bool init) if (dark != -1 && dark != (*p_bg == 'd') && !option_was_set("bg")) { - set_option_value_give_err("bg", 0L, (dark ? "dark" : "light"), 0); + set_option_value_give_err("bg", CSTR_AS_OPTVAL(dark ? "dark" : "light"), 0); reset_option_was_set("bg"); } } -- cgit From 1b679ac192877ae21e531d2eaa88ef0918f1dfe1 Mon Sep 17 00:00:00 2001 From: Chinmay Dalal Date: Wed, 21 Jun 2023 13:03:56 +0530 Subject: fix(lsp): define LspInlayHint highlight group #24073 fixes #24068 Co-authored-by: Justin M. Keyes --- src/nvim/highlight_group.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 48e4479c58..da43f678bc 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -231,6 +231,7 @@ static const char *highlight_init_both[] = { "default link DiagnosticSignOk DiagnosticOk", "default DiagnosticDeprecated cterm=strikethrough gui=strikethrough guisp=Red", "default link DiagnosticUnnecessary Comment", + "default link LspInlayHint NonText", // Text "default link @text.literal Comment", -- cgit From 516b173780e39de3ce1e4525f0a8f0ff250c992b Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Thu, 13 Jul 2023 10:17:19 +0100 Subject: perf(rtp): reduce rtp scans (#24191) * perf(rtp): reduce rtp scans Problem: Scanning the filesystem is expensive and particularly affects startuptime. Solution: Reduce the amount of redundant directory scans by relying less on glob patterns and handle vim and lua sourcing lower down. --- src/nvim/highlight_group.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index da43f678bc..8bcfbc8069 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -697,20 +697,8 @@ int load_colors(char *name) size_t buflen = strlen(name) + 12; char *buf = xmalloc(buflen); apply_autocmds(EVENT_COLORSCHEMEPRE, name, curbuf->b_fname, false, curbuf); - snprintf(buf, buflen, "colors/%s.vim", name); - int retval = source_runtime(buf, 0); - if (retval == FAIL) { - snprintf(buf, buflen, "colors/%s.lua", name); - retval = source_runtime(buf, 0); - } - if (retval == FAIL) { - snprintf(buf, buflen, "colors/%s.vim", name); - retval = source_runtime(buf, DIP_NORTP + DIP_START + DIP_OPT); - } - if (retval == FAIL) { - snprintf(buf, buflen, "colors/%s.lua", name); - retval = source_runtime(buf, DIP_NORTP + DIP_START + DIP_OPT); - } + snprintf(buf, buflen, "colors/%s.*", name); + int retval = source_runtime_vim_lua(buf, DIP_START + DIP_OPT); xfree(buf); if (retval == OK) { apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname, false, curbuf); -- cgit From 59289fb987bd51b072f91ae0de8ee8515bf07e21 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 23 Jul 2023 21:36:32 +0800 Subject: fix(highlight): make CurSearch work properly with 'winhl' (#24448) --- src/nvim/highlight_group.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 8bcfbc8069..9ae928a0d2 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -162,6 +162,7 @@ static const char *highlight_init_both[] = { "default link QuickFixLine Search", "default link CursorLineSign SignColumn", "default link CursorLineFold FoldColumn", + "default link CurSearch Search", "default link PmenuKind Pmenu", "default link PmenuKindSel PmenuSel", "default link PmenuExtra Pmenu", @@ -2163,8 +2164,7 @@ void highlight_changed(void) id_S = final_id; } - highlight_attr[hlf] = hl_get_ui_attr(ns_id, hlf, final_id, - (hlf == HLF_INACTIVE || hlf == HLF_LC)); + highlight_attr[hlf] = hl_get_ui_attr(ns_id, hlf, final_id, hlf == HLF_INACTIVE); if (highlight_attr[hlf] != highlight_attr_last[hlf]) { if (hlf == HLF_MSG) { -- cgit From 7bc93e0e2f246dd78026a3472d929a0fe450f70d Mon Sep 17 00:00:00 2001 From: bfredl Date: Tue, 1 Aug 2023 14:01:19 +0200 Subject: refactor(api): use typed keysets Initially this is just for geting rid of boilerplate, but eventually the types could get exposed as metadata --- src/nvim/highlight_group.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 9ae928a0d2..de53545195 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -832,9 +832,11 @@ void set_hl_group(int id, HlAttrs attrs, Dict(highlight) *dict, int link_id) struct { int *dest; RgbValue val; Object name; } cattrs[] = { - { &g->sg_rgb_fg_idx, g->sg_rgb_fg, HAS_KEY(dict->fg) ? dict->fg : dict->foreground }, - { &g->sg_rgb_bg_idx, g->sg_rgb_bg, HAS_KEY(dict->bg) ? dict->bg : dict->background }, - { &g->sg_rgb_sp_idx, g->sg_rgb_sp, HAS_KEY(dict->sp) ? dict->sp : dict->special }, + { &g->sg_rgb_fg_idx, g->sg_rgb_fg, + HAS_KEY(dict, highlight, fg) ? dict->fg : dict->foreground }, + { &g->sg_rgb_bg_idx, g->sg_rgb_bg, + HAS_KEY(dict, highlight, bg) ? dict->bg : dict->background }, + { &g->sg_rgb_sp_idx, g->sg_rgb_sp, HAS_KEY(dict, highlight, sp) ? dict->sp : dict->special }, { NULL, -1, NIL }, }; @@ -1563,19 +1565,12 @@ static bool hlgroup2dict(Dictionary *hl, NS ns_id, int hl_id, Arena *arena) Dictionary ns_get_hl_defs(NS ns_id, Dict(get_highlight) *opts, Arena *arena, Error *err) { - Boolean link = api_object_to_bool(opts->link, "link", true, err); + Boolean link = GET_BOOL_OR_TRUE(opts, get_highlight, link); int id = -1; - if (opts->name.type != kObjectTypeNil) { - VALIDATE_T("highlight name", kObjectTypeString, opts->name.type, { - goto cleanup; - }); - String name = opts->name.data.string; - id = syn_check_group(name.data, name.size); - } else if (opts->id.type != kObjectTypeNil) { - VALIDATE_T("highlight id", kObjectTypeInteger, opts->id.type, { - goto cleanup; - }); - id = (int)opts->id.data.integer; + if (HAS_KEY(opts, get_highlight, name)) { + id = syn_check_group(opts->name.data, opts->name.size); + } else if (HAS_KEY(opts, get_highlight, id)) { + id = (int)opts->id; } if (id != -1) { -- cgit From e72c0cd92090c1fc1e5665a060b3e1d0094d7f30 Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:25:51 -0500 Subject: feat(highlight): Allow hyphens (-) in highlight group names (#24714) Fixes: https://github.com/neovim/neovim/issues/23184 --- src/nvim/highlight_group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index de53545195..60cafb0abb 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1942,7 +1942,7 @@ static int syn_add_group(const char *name, size_t len) if (!vim_isprintc(c)) { emsg(_("E669: Unprintable character in group name")); return 0; - } else if (!ASCII_ISALNUM(c) && c != '_' && c != '.' && c != '@') { + } else if (!ASCII_ISALNUM(c) && c != '_' && c != '.' && c != '@' && c != '-') { // '.' and '@' are allowed characters for use with treesitter capture names. msg_source(HL_ATTR(HLF_W)); emsg(_(e_highlight_group_name_invalid_char)); -- cgit From 91d8f2ac534a51859c0e3c6562d07c94b27f4478 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 21 Aug 2023 10:25:41 +0800 Subject: vim-patch:9.0.1767: '.-' no allowed in highlight group names (#24814) Problem: '.-' no allowed in highlight group names Solution: Allow dot and hyphen characters in highlight group names Allow dots and hyphens in group names. There does not seem to be any reason for these to be disallowed. closes: vim/vim#12807 https://github.com/vim/vim/commit/d4376dc3ebea91abcb4d9ef9963ef5b968048b78 Co-authored-by: Gregory Anders Co-authored-by: Sean Dewar --- src/nvim/highlight_group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 60cafb0abb..2b268ff2e1 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1936,7 +1936,7 @@ int syn_check_group(const char *name, size_t len) /// @see syn_check_group static int syn_add_group(const char *name, size_t len) { - // Check that the name is ASCII letters, digits and underscore. + // Check that the name is valid (ASCII letters, digits, '_', '.', '@', '-'). for (size_t i = 0; i < len; i++) { int c = (uint8_t)name[i]; if (!vim_isprintc(c)) { -- cgit From 986bf7e78d09286e198b696630254eb097ad0875 Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Fri, 25 Aug 2023 10:53:39 +0300 Subject: feat(highlight): add `FloatFooter` highlight group Problem: No clear separation of floating title and footer highlighting. Solution: Add new `FloatFooter` highlight group. --- src/nvim/highlight_group.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 2b268ff2e1..c4d140d1e1 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -173,6 +173,7 @@ static const char *highlight_init_both[] = { "default link NormalFloat Pmenu", "default link FloatBorder WinSeparator", "default link FloatTitle Title", + "default link FloatFooter Title", "default FloatShadow blend=80 guibg=Black", "default FloatShadowThrough blend=100 guibg=Black", "RedrawDebugNormal cterm=reverse gui=reverse", -- cgit From 8afb3a49c0762eb60368aee0314e6de261daa6ef Mon Sep 17 00:00:00 2001 From: glepnir Date: Thu, 7 Sep 2023 18:42:38 +0800 Subject: fix(highlight): add create param in nvim_get_hl --- src/nvim/highlight_group.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index c4d140d1e1..b970e752bb 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1569,7 +1569,13 @@ Dictionary ns_get_hl_defs(NS ns_id, Dict(get_highlight) *opts, Arena *arena, Err Boolean link = GET_BOOL_OR_TRUE(opts, get_highlight, link); int id = -1; if (HAS_KEY(opts, get_highlight, name)) { - id = syn_check_group(opts->name.data, opts->name.size); + Boolean create = GET_BOOL_OR_TRUE(opts, get_highlight, create); + id = create ? syn_check_group(opts->name.data, opts->name.size) + : syn_name2id_len(opts->name.data, opts->name.size); + if (id == 0 && !create) { + Dictionary attrs = ARRAY_DICT_INIT; + return attrs; + } } else if (HAS_KEY(opts, get_highlight, id)) { id = (int)opts->id; } -- cgit From 51836517738babaa406bc615fd9984129c5179a4 Mon Sep 17 00:00:00 2001 From: glepnir Date: Sat, 16 Sep 2023 19:08:40 +0800 Subject: fix(highlight): correct hi command output --- src/nvim/highlight_group.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index b970e752bb..84cf19ba69 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -824,7 +824,7 @@ void set_hl_group(int id, HlAttrs attrs, Dict(highlight) *dict, int link_id) g->sg_link = 0; } - g->sg_gui = attrs.rgb_ae_attr; + g->sg_gui = attrs.rgb_ae_attr &~HL_DEFAULT; g->sg_rgb_fg = attrs.rgb_fg_color; g->sg_rgb_bg = attrs.rgb_bg_color; @@ -851,7 +851,7 @@ void set_hl_group(int id, HlAttrs attrs, Dict(highlight) *dict, int link_id) } } - g->sg_cterm = attrs.cterm_ae_attr; + g->sg_cterm = attrs.cterm_ae_attr &~HL_DEFAULT; g->sg_cterm_bg = attrs.cterm_bg_color; g->sg_cterm_fg = attrs.cterm_fg_color; g->sg_cterm_bold = g->sg_cterm & HL_BOLD; @@ -1441,7 +1441,7 @@ void restore_cterm_colors(void) /// @param check_link if true also check for an existing link. /// /// @return true if highlight group "idx" has any settings. -static int hl_has_settings(int idx, bool check_link) +static bool hl_has_settings(int idx, bool check_link) { return hl_table[idx].sg_cleared == 0 && (hl_table[idx].sg_attr != 0 -- cgit From f8ea49cfe1f4f3ed30da160d346553f0949ec1de Mon Sep 17 00:00:00 2001 From: glepnir Date: Mon, 18 Sep 2023 14:50:27 +0800 Subject: fix(highlight): add force in nvim_set_hl --- src/nvim/highlight_group.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 84cf19ba69..eeed58a9ab 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -799,11 +799,10 @@ int lookup_color(const int idx, const bool foreground, TriState *const boldp) void set_hl_group(int id, HlAttrs attrs, Dict(highlight) *dict, int link_id) { int idx = id - 1; // Index is ID minus one. - bool is_default = attrs.rgb_ae_attr & HL_DEFAULT; // Return if "default" was used and the group already has settings - if (is_default && hl_has_settings(idx, true)) { + if (is_default && hl_has_settings(idx, true) && !dict->force) { return; } -- cgit From f91cd31d7d9d70006e0000592637d5d997eab52c Mon Sep 17 00:00:00 2001 From: bfredl Date: Wed, 27 Sep 2023 21:46:39 +0200 Subject: refactor(messages): fold msg_outtrans_attr into msg_outtrans problem: there are too many different functions in message.c solution: fold some of the functions into themselves --- src/nvim/highlight_group.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index eeed58a9ab..c097c6a524 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1523,7 +1523,7 @@ static void highlight_list_one(const int id) didh = true; msg_puts_attr("links to", HL_ATTR(HLF_D)); msg_putchar(' '); - msg_outtrans(hl_table[hl_table[id - 1].sg_link - 1].sg_name); + msg_outtrans(hl_table[hl_table[id - 1].sg_link - 1].sg_name, 0); } if (!didh) { @@ -1656,7 +1656,7 @@ static bool highlight_list_arg(const int id, bool didh, const int type, int iarg msg_puts_attr(name, HL_ATTR(HLF_D)); msg_puts_attr("=", HL_ATTR(HLF_D)); } - msg_outtrans(ts); + msg_outtrans(ts, 0); } return didh; } @@ -1786,7 +1786,7 @@ bool syn_list_header(const bool did_header, const int outlen, const int id, bool if (got_int) { return true; } - msg_outtrans(hl_table[id - 1].sg_name); + msg_outtrans(hl_table[id - 1].sg_name, 0); name_col = msg_col; endcol = 15; } else if ((ui_has(kUIMessages) || msg_silent) && !force_newline) { -- cgit From cf8b2c0e74fd5e723b0c15c2ce84e6900fd322d3 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 30 Sep 2023 12:05:28 +0800 Subject: build(iwyu): add a few more _defs.h mappings (#25435) --- src/nvim/highlight_group.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index c097c6a524..f53105aefa 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -10,12 +10,13 @@ #include #include +#include "klib/kvec.h" +#include "nvim/api/keysets.h" #include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/api/private/validate.h" #include "nvim/ascii.h" #include "nvim/autocmd.h" -#include "nvim/buffer_defs.h" #include "nvim/charset.h" #include "nvim/cursor_shape.h" #include "nvim/decoration_provider.h" @@ -28,7 +29,6 @@ #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" -#include "nvim/grid_defs.h" #include "nvim/highlight.h" #include "nvim/highlight_group.h" #include "nvim/lua/executor.h" -- cgit From dc6d0d2daf69e2fdadda81feb97906dbc962a239 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 30 Sep 2023 14:41:34 +0800 Subject: refactor: reorganize option header files (#25437) - Move vimoption_T to option.h - option_defs.h is for option-related types - option_vars.h corresponds to Vim's option.h - option_defs.h and option_vars.h don't include each other --- src/nvim/highlight_group.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index f53105aefa..080dc79e0e 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -37,6 +37,7 @@ #include "nvim/memory.h" #include "nvim/message.h" #include "nvim/option.h" +#include "nvim/option_vars.h" #include "nvim/os/time.h" #include "nvim/runtime.h" #include "nvim/strings.h" -- cgit From 01c51a491330bd10202c73aff92c0978984c0692 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 1 Oct 2023 19:07:16 +0800 Subject: feat(completion): support completing more string options --- src/nvim/highlight_group.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 080dc79e0e..d2cdcb2516 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -2283,10 +2283,10 @@ static void highlight_list_two(int cnt, int attr) } /// Function given to ExpandGeneric() to obtain the list of group names. -const char *get_highlight_name(expand_T *const xp, int idx) +char *get_highlight_name(expand_T *const xp, int idx) FUNC_ATTR_WARN_UNUSED_RESULT { - return get_highlight_name_ext(xp, idx, true); + return (char *)get_highlight_name_ext(xp, idx, true); } /// Obtain a highlight group name. -- cgit From 09a17f91d0d362c6e58bfdbe3ccdeacffb0b44b9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 2 Oct 2023 10:45:33 +0800 Subject: refactor: move cmdline completion types to cmdexpand_defs.h (#25465) --- src/nvim/highlight_group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index d2cdcb2516..c526df5de4 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -18,13 +18,13 @@ #include "nvim/ascii.h" #include "nvim/autocmd.h" #include "nvim/charset.h" +#include "nvim/cmdexpand_defs.h" #include "nvim/cursor_shape.h" #include "nvim/decoration_provider.h" #include "nvim/drawscreen.h" #include "nvim/eval.h" #include "nvim/eval/typval_defs.h" #include "nvim/eval/vars.h" -#include "nvim/ex_cmds_defs.h" #include "nvim/ex_docmd.h" #include "nvim/garray.h" #include "nvim/gettext.h" -- cgit From d4872377fef7eeb794ea06321f62281af0cde8e3 Mon Sep 17 00:00:00 2001 From: glepnir Date: Tue, 3 Oct 2023 19:26:11 +0800 Subject: fix(highlight): attr set all when normal attr changed --- src/nvim/highlight_group.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 080dc79e0e..09a28989e4 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -866,9 +866,17 @@ void set_hl_group(int id, HlAttrs attrs, Dict(highlight) *dict, int link_id) if (strcmp(g->sg_name_u, "NORMAL") == 0) { cterm_normal_fg_color = g->sg_cterm_fg; cterm_normal_bg_color = g->sg_cterm_bg; + bool did_changed = false; + if (normal_bg != g->sg_rgb_bg || normal_fg != g->sg_rgb_fg || normal_sp != g->sg_rgb_sp) { + did_changed = true; + } normal_fg = g->sg_rgb_fg; normal_bg = g->sg_rgb_bg; normal_sp = g->sg_rgb_sp; + + if (did_changed) { + highlight_attr_set_all(); + } ui_default_colors_set(); } else { // a cursor style uses this syn_id, make sure its attribute is updated. -- cgit From f1775da07fe48da629468bcfcc2a8a6c4c3f40ed Mon Sep 17 00:00:00 2001 From: Maria José Solano Date: Fri, 20 Oct 2023 23:51:26 -0700 Subject: feat(lsp): add snippet API (#25301) --- src/nvim/highlight_group.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 5cbff6e3dd..2fa92f377d 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -235,6 +235,7 @@ static const char *highlight_init_both[] = { "default DiagnosticDeprecated cterm=strikethrough gui=strikethrough guisp=Red", "default link DiagnosticUnnecessary Comment", "default link LspInlayHint NonText", + "default link SnippetTabstop Visual", // Text "default link @text.literal Comment", -- cgit From 5f03a1eaabfc8de2b3a9c666fcd604763f41e152 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 20 Oct 2023 15:10:33 +0200 Subject: build(lint): remove unnecessary clint.py rules Uncrustify is the source of truth where possible. Remove any redundant checks from clint.py. --- src/nvim/highlight_group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 2fa92f377d..e21277b0db 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -960,7 +960,7 @@ void do_highlight(const char *line, const bool forceit, const bool init) from_end = skiptowhite(from_start); to_start = skipwhite(from_end); - to_end = skiptowhite(to_start); + to_end = skiptowhite(to_start); if (ends_excmd((uint8_t)(*from_start)) || ends_excmd((uint8_t)(*to_start))) { -- cgit From acc646ad8fc3ef11fcc63b69f3d8484e4a91accd Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 29 Sep 2023 14:58:48 +0200 Subject: refactor: the long goodbye long is 32 bits on windows, while it is 64 bits on other architectures. This makes the type suboptimal for a codebase meant to be cross-platform. Replace it with more appropriate integer types. --- src/nvim/highlight_group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index e21277b0db..ec35da54d2 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -2288,7 +2288,7 @@ static void highlight_list_two(int cnt, int attr) msg_puts_attr(&("N \bI \b! \b"[cnt / 11]), attr); msg_clr_eos(); ui_flush(); - os_delay(cnt == 99 ? 40L : (uint64_t)cnt * 50L, false); + os_delay(cnt == 99 ? 40 : (uint64_t)cnt * 50, false); } /// Function given to ExpandGeneric() to obtain the list of group names. -- cgit From 353a4be7e84fdc101318215bdcc8a7e780d737fe Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 12 Nov 2023 13:13:58 +0100 Subject: build: remove PVS We already have an extensive suite of static analysis tools we use, which causes a fair bit of redundancy as we get duplicate warnings. PVS is also prone to give false warnings which creates a lot of work to identify and disable. --- src/nvim/highlight_group.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index ec35da54d2..660e37adc2 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - // highlight_group.c: code for managing highlight groups #include -- cgit From 8b428ca8b79ebb7b36c3e403ff3bcb6924a635a6 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 16:00:21 +0100 Subject: build(IWYU): fix includes for func_attr.h --- src/nvim/highlight_group.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 660e37adc2..e3f5987bd6 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -23,6 +23,7 @@ #include "nvim/eval/typval_defs.h" #include "nvim/eval/vars.h" #include "nvim/ex_docmd.h" +#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" -- cgit From e38a05369293293b5b510b1b0014fcc2e7cb87f4 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 18:46:03 +0100 Subject: build(IWYU): export generated headers --- src/nvim/highlight_group.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index e3f5987bd6..aee62f6104 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -10,6 +10,7 @@ #include "klib/kvec.h" #include "nvim/api/keysets.h" #include "nvim/api/private/defs.h" +#include "nvim/api/private/dispatch.h" #include "nvim/api/private/helpers.h" #include "nvim/api/private/validate.h" #include "nvim/ascii.h" -- cgit From e3f735ef101d670555f44226614a5c3557053b1f Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 20:13:32 +0100 Subject: refactor: fix includes for api/autocmd.h --- src/nvim/highlight_group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index aee62f6104..e7518fcde0 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -8,7 +8,7 @@ #include #include "klib/kvec.h" -#include "nvim/api/keysets.h" +#include "nvim/api/keysets_defs.h" #include "nvim/api/private/defs.h" #include "nvim/api/private/dispatch.h" #include "nvim/api/private/helpers.h" -- cgit From 6c14ae6bfaf51415b555e9a6b85d1d280976358d Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 20:27:32 +0100 Subject: refactor: rename types.h to types_defs.h --- src/nvim/highlight_group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index e7518fcde0..e32d16cd1d 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -40,7 +40,7 @@ #include "nvim/os/time.h" #include "nvim/runtime.h" #include "nvim/strings.h" -#include "nvim/types.h" +#include "nvim/types_defs.h" #include "nvim/ui.h" #include "nvim/vim.h" -- cgit From 79b6ff28ad1204fbb4199b9092f5c578d88cb28e Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 28 Nov 2023 20:31:00 +0100 Subject: refactor: fix headers with IWYU --- src/nvim/highlight_group.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/nvim/highlight_group.c') diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index e32d16cd1d..3f1758894e 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -13,7 +13,7 @@ #include "nvim/api/private/dispatch.h" #include "nvim/api/private/helpers.h" #include "nvim/api/private/validate.h" -#include "nvim/ascii.h" +#include "nvim/ascii_defs.h" #include "nvim/autocmd.h" #include "nvim/charset.h" #include "nvim/cmdexpand_defs.h" @@ -31,8 +31,8 @@ #include "nvim/highlight.h" #include "nvim/highlight_group.h" #include "nvim/lua/executor.h" -#include "nvim/macros.h" -#include "nvim/map.h" +#include "nvim/macros_defs.h" +#include "nvim/map_defs.h" #include "nvim/memory.h" #include "nvim/message.h" #include "nvim/option.h" @@ -42,7 +42,7 @@ #include "nvim/strings.h" #include "nvim/types_defs.h" #include "nvim/ui.h" -#include "nvim/vim.h" +#include "nvim/vim_defs.h" /// \addtogroup SG_SET /// @{ -- cgit