diff options
author | Luuk van Baal <luukvbaal@gmail.com> | 2024-02-20 17:25:57 +0100 |
---|---|---|
committer | Luuk van Baal <luukvbaal@gmail.com> | 2024-11-08 13:21:35 +0100 |
commit | 5cfa7a72f8c40cdcc0fa93693689915e913806f1 (patch) | |
tree | 2c482565d5667dc0ec9caca6e893da7d5a37359a /src/nvim/quickfix.c | |
parent | 5a86360400691e55fae66d60485b61360a1d3d6c (diff) | |
download | rneovim-5cfa7a72f8c40cdcc0fa93693689915e913806f1.tar.gz rneovim-5cfa7a72f8c40cdcc0fa93693689915e913806f1.tar.bz2 rneovim-5cfa7a72f8c40cdcc0fa93693689915e913806f1.zip |
refactor(message): propagate highlight id instead of attrs
Problem: Highlight group id is not propagated to the end of the message call
stack, where ext_messages are emitted.
Solution: Refactor message functions to pass along highlight group id
instead of attr id.
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r-- | src/nvim/quickfix.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index f037d5d924..304b72ce12 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -2937,7 +2937,7 @@ static void qf_jump_print_msg(qf_info_T *qi, int qf_index, qfline_T *qf_ptr, buf msg_scroll = false; } msg_ext_set_kind("quickfix"); - msg_attr_keep(gap->ga_data, 0, true, false); + msg_hl_keep(gap->ga_data, 0, true, false); msg_scroll = (int)i; qfga_clear(); @@ -3144,10 +3144,10 @@ theend: decr_quickfix_busy(); } -// Highlight attributes used for displaying entries from the quickfix list. -static int qfFileAttr; -static int qfSepAttr; -static int qfLineAttr; +// Highlight ids used for displaying entries from the quickfix list. +static int qfFile_hl_id; +static int qfSep_hl_id; +static int qfLine_hl_id; /// Display information about a single entry from the quickfix/location list. /// Used by ":clist/:llist" commands. @@ -3195,10 +3195,10 @@ static void qf_list_entry(qfline_T *qfp, int qf_idx, bool cursel) } msg_putchar('\n'); - msg_outtrans(IObuff, cursel ? HL_ATTR(HLF_QFL) : qfFileAttr); + msg_outtrans(IObuff, cursel ? HLF_QFL + 1 : qfFile_hl_id, false); if (qfp->qf_lnum != 0) { - msg_puts_attr(":", qfSepAttr); + msg_puts_hl(":", qfSep_hl_id, false); } garray_T *gap = qfga_get(); if (qfp->qf_lnum != 0) { @@ -3206,14 +3206,14 @@ static void qf_list_entry(qfline_T *qfp, int qf_idx, bool cursel) } ga_concat(gap, qf_types(qfp->qf_type, qfp->qf_nr)); ga_append(gap, NUL); - msg_puts_attr(gap->ga_data, qfLineAttr); - msg_puts_attr(":", qfSepAttr); + msg_puts_hl(gap->ga_data, qfLine_hl_id, false); + msg_puts_hl(":", qfSep_hl_id, false); if (qfp->qf_pattern != NULL) { gap = qfga_get(); qf_fmt_text(gap, qfp->qf_pattern); ga_append(gap, NUL); msg_puts(gap->ga_data); - msg_puts_attr(":", qfSepAttr); + msg_puts_hl(":", qfSep_hl_id, false); } msg_puts(" "); @@ -3275,17 +3275,17 @@ void qf_list(exarg_T *eap) // Get the attributes for the different quickfix highlight items. Note // that this depends on syntax items defined in the qf.vim syntax file - qfFileAttr = syn_name2attr("qfFileName"); - if (qfFileAttr == 0) { - qfFileAttr = HL_ATTR(HLF_D); + qfFile_hl_id = syn_name2id("qfFileName"); + if (qfFile_hl_id == 0) { + qfFile_hl_id = HLF_D + 1; } - qfSepAttr = syn_name2attr("qfSeparator"); - if (qfSepAttr == 0) { - qfSepAttr = HL_ATTR(HLF_D); + qfSep_hl_id = syn_name2id("qfSeparator"); + if (qfSep_hl_id == 0) { + qfSep_hl_id = HLF_D + 1; } - qfLineAttr = syn_name2attr("qfLineNr"); - if (qfLineAttr == 0) { - qfLineAttr = HL_ATTR(HLF_N); + qfLine_hl_id = syn_name2id("qfLineNr"); + if (qfLine_hl_id == 0) { + qfLine_hl_id = HLF_N + 1; } if (qfl->qf_nonevalid) { @@ -4396,7 +4396,7 @@ static char *make_get_fullcmd(const char *makecmd, const char *fname) } msg_start(); msg_puts(":!"); - msg_outtrans(cmd, 0); // show what we are doing + msg_outtrans(cmd, 0, false); // show what we are doing return cmd; } @@ -5243,9 +5243,9 @@ static void vgr_display_fname(char *fname) msg_start(); char *p = msg_strtrunc(fname, true); if (p == NULL) { - msg_outtrans(fname, 0); + msg_outtrans(fname, 0, false); } else { - msg_outtrans(p, 0); + msg_outtrans(p, 0, false); xfree(p); } msg_clr_eos(); |