aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2024-11-11 12:26:35 +0100
committerGitHub <noreply@github.com>2024-11-11 12:26:35 +0100
commitd0e78b587195d201d643f3e131dd1ea951d906db (patch)
tree2a08bef2c02751daf28a33be8c57049554b57726
parent7919aa9102e1b9b7a9f7feaea6b134a98f5b60fc (diff)
parent4f9260d06a48216862ebb34fc33744486b058f58 (diff)
downloadrneovim-d0e78b587195d201d643f3e131dd1ea951d906db.tar.gz
rneovim-d0e78b587195d201d643f3e131dd1ea951d906db.tar.bz2
rneovim-d0e78b587195d201d643f3e131dd1ea951d906db.zip
Merge pull request #27813 from luukvbaal/msgid
feat(ext_messages): add hl_id to ext_messages chunks
-rw-r--r--runtime/doc/news.txt2
-rw-r--r--runtime/doc/ui.txt9
-rw-r--r--src/nvim/api/private/helpers.c7
-rw-r--r--src/nvim/api/vim.c2
-rw-r--r--src/nvim/autocmd.c16
-rw-r--r--src/nvim/buffer.c2
-rw-r--r--src/nvim/bufwrite.c14
-rw-r--r--src/nvim/change.c4
-rw-r--r--src/nvim/cmdexpand.c17
-rw-r--r--src/nvim/cmdhist.c2
-rw-r--r--src/nvim/decoration_defs.h2
-rw-r--r--src/nvim/digraph.c8
-rw-r--r--src/nvim/drawscreen.c57
-rw-r--r--src/nvim/eval.c16
-rw-r--r--src/nvim/eval/vars.c4
-rw-r--r--src/nvim/ex_cmds.c12
-rw-r--r--src/nvim/ex_cmds2.c2
-rw-r--r--src/nvim/ex_docmd.c6
-rw-r--r--src/nvim/ex_getln.c40
-rw-r--r--src/nvim/ex_getln_defs.h6
-rw-r--r--src/nvim/fileio.c28
-rw-r--r--src/nvim/globals.h2
-rw-r--r--src/nvim/highlight_group.c22
-rw-r--r--src/nvim/input.c2
-rw-r--r--src/nvim/insexpand.c10
-rw-r--r--src/nvim/mapping.c10
-rw-r--r--src/nvim/mark.c13
-rw-r--r--src/nvim/memline.c51
-rw-r--r--src/nvim/menu.c4
-rw-r--r--src/nvim/message.c251
-rw-r--r--src/nvim/message.h2
-rw-r--r--src/nvim/message_defs.h6
-rw-r--r--src/nvim/normal.c7
-rw-r--r--src/nvim/ops.c14
-rw-r--r--src/nvim/option.c6
-rw-r--r--src/nvim/os/shell.c8
-rw-r--r--src/nvim/quickfix.c44
-rw-r--r--src/nvim/runtime.c2
-rw-r--r--src/nvim/search.c14
-rw-r--r--src/nvim/sign.c6
-rw-r--r--src/nvim/statusline.c4
-rw-r--r--src/nvim/syntax.c90
-rw-r--r--src/nvim/tag.c26
-rw-r--r--src/nvim/ui.c4
-rw-r--r--src/nvim/undo.c16
-rw-r--r--src/nvim/usercmd.c9
-rw-r--r--test/functional/lua/ui_event_spec.lua6
-rw-r--r--test/functional/ui/embed_spec.lua18
-rw-r--r--test/functional/ui/hlstate_spec.lua40
-rw-r--r--test/functional/ui/messages_spec.lua160
-rw-r--r--test/functional/ui/screen.lua4
51 files changed, 553 insertions, 554 deletions
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index df794596b8..41b9d623a2 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -283,6 +283,8 @@ UI
|hl-PmenuMatchSel| inherits highlights from both |hl-PmenuSel| and
|hl-PmenuMatch|.
+• |ui-messages| content chunks now also contain the highlight group ID.
+
==============================================================================
CHANGED FEATURES *news-changed*
diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt
index cb057a8fd2..4ee8121034 100644
--- a/runtime/doc/ui.txt
+++ b/runtime/doc/ui.txt
@@ -805,10 +805,11 @@ must handle.
kinds as the empty kind.
content
- Array of `[attr_id, text_chunk]` tuples, building up the message
- text of chunks of different highlights. No extra spacing should be
- added between chunks, the `text_chunk` by itself contains any
- necessary whitespace. Messages can contain line breaks "\n".
+ Array of `[attr_id, text_chunk, hl_id]` tuples, building up the
+ message text of chunks of different highlights. No extra spacing
+ should be added between chunks, the `text_chunk` by itself
+ contains any necessary whitespace. Messages can contain line
+ breaks "\n".
replace_last
Decides how multiple messages should be displayed:
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index e1fb4ed732..d21caf7ed0 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -824,16 +824,15 @@ HlMessage parse_hl_msg(Array chunks, Error *err)
String str = copy_string(chunk.items[0].data.string, NULL);
- int attr = 0;
+ int hl_id = 0;
if (chunk.size == 2) {
String hl = chunk.items[1].data.string;
if (hl.size > 0) {
// TODO(bfredl): use object_to_hl_id and allow integer
- int hl_id = syn_check_group(hl.data, hl.size);
- attr = hl_id > 0 ? syn_id2attr(hl_id) : 0;
+ hl_id = syn_check_group(hl.data, hl.size);
}
}
- kv_push(hl_msg, ((HlMessageChunk){ .text = str, .attr = attr }));
+ kv_push(hl_msg, ((HlMessageChunk){ .text = str, .hl_id = hl_id }));
}
return hl_msg;
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 97cda49a22..ee05ad28ac 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -796,7 +796,7 @@ void nvim_echo(Array chunks, Boolean history, Dict(echo_opts) *opts, Error *err)
verbose_enter();
}
- msg_multiattr(hl_msg, history ? "echomsg" : "echo", history);
+ msg_multihl(hl_msg, history ? "echomsg" : "echo", history);
if (opts->verbose) {
verbose_leave();
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 5a4ade913d..a62ff6d8ec 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -220,14 +220,14 @@ static void au_show_for_event(int group, event_T event, const char *pat)
// show the group name, if it's not the default group
if (ac->pat->group != AUGROUP_DEFAULT) {
if (last_group_name == NULL) {
- msg_puts_attr(get_deleted_augroup(), HL_ATTR(HLF_E));
+ msg_puts_hl(get_deleted_augroup(), HLF_E + 1, false);
} else {
- msg_puts_attr(last_group_name, HL_ATTR(HLF_T));
+ msg_puts_hl(last_group_name, HLF_T + 1, false);
}
msg_puts(" ");
}
// show the event name
- msg_puts_attr(event_nr2name(event), HL_ATTR(HLF_T));
+ msg_puts_hl(event_nr2name(event), HLF_T + 1, false);
}
// Show pattern only if it changed.
@@ -240,7 +240,7 @@ static void au_show_for_event(int group, event_T event, const char *pat)
}
msg_col = 4;
- msg_outtrans(ac->pat->pat, 0);
+ msg_outtrans(ac->pat->pat, 0, false);
}
if (got_int) {
@@ -260,17 +260,17 @@ static void au_show_for_event(int group, event_T event, const char *pat)
size_t msglen = 100;
char *msg = xmallocz(msglen);
if (ac->exec.type == CALLABLE_CB) {
- msg_puts_attr(exec_to_string, HL_ATTR(HLF_8));
+ msg_puts_hl(exec_to_string, HLF_8 + 1, false);
snprintf(msg, msglen, " [%s]", ac->desc);
} else {
snprintf(msg, msglen, "%s [%s]", exec_to_string, ac->desc);
}
- msg_outtrans(msg, 0);
+ msg_outtrans(msg, 0, false);
XFREE_CLEAR(msg);
} else if (ac->exec.type == CALLABLE_CB) {
- msg_puts_attr(exec_to_string, HL_ATTR(HLF_8));
+ msg_puts_hl(exec_to_string, HLF_8 + 1, false);
} else {
- msg_outtrans(exec_to_string, 0);
+ msg_outtrans(exec_to_string, 0, false);
}
XFREE_CLEAR(exec_to_string);
if (p_verbose > 0) {
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index fe22742a84..abcce0dfe8 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -2902,7 +2902,7 @@ void buflist_list(exarg_T *eap)
buf == curbuf ? (int64_t)curwin->w_cursor.lnum : (int64_t)buflist_findlnum(buf));
}
- msg_outtrans(IObuff, 0);
+ msg_outtrans(IObuff, 0, false);
line_breakcheck();
}
diff --git a/src/nvim/bufwrite.c b/src/nvim/bufwrite.c
index fa0a55e7b6..2752ef5c59 100644
--- a/src/nvim/bufwrite.c
+++ b/src/nvim/bufwrite.c
@@ -350,7 +350,7 @@ static int check_mtime(buf_T *buf, FileInfo *file_info)
msg_scroll = true; // Don't overwrite messages here.
msg_silent = 0; // Must give this prompt.
// Don't use emsg() here, don't want to flush the buffers.
- msg(_("WARNING: The file has been changed since reading it!!!"), HL_ATTR(HLF_E));
+ msg(_("WARNING: The file has been changed since reading it!!!"), HLF_E + 1);
if (ask_yesno(_("Do you really want to write to it"), true) == 'n') {
return FAIL;
}
@@ -1150,9 +1150,9 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
if (!filtering) {
// show that we are busy
#ifndef UNIX
- filemess(buf, sfname, "", 0);
+ filemess(buf, sfname, "");
#else
- filemess(buf, fname, "", 0);
+ filemess(buf, fname, "");
#endif
}
msg_scroll = false; // always overwrite the file message now
@@ -1881,11 +1881,9 @@ nofail:
retval = FAIL;
if (end == 0) {
- const int attr = HL_ATTR(HLF_E); // Set highlight for error messages.
- msg_puts_attr(_("\nWARNING: Original file may be lost or damaged\n"),
- attr | MSG_HIST);
- msg_puts_attr(_("don't quit the editor until the file is successfully written!"),
- attr | MSG_HIST);
+ const int hl_id = HLF_E + 1; // Set highlight for error messages.
+ msg_puts_hl(_("\nWARNING: Original file may be lost or damaged\n"), hl_id, true);
+ msg_puts_hl(_("don't quit the editor until the file is successfully written!"), hl_id, true);
// Update the timestamp to avoid an "overwrite changed file"
// prompt when writing again.
diff --git a/src/nvim/change.c b/src/nvim/change.c
index 51a13b80e7..3d78b17f2a 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -89,9 +89,9 @@ void change_warning(buf_T *buf, int col)
if (msg_row == Rows - 1) {
msg_col = col;
}
- msg_source(HL_ATTR(HLF_W));
+ msg_source(HLF_W + 1);
msg_ext_set_kind("wmsg");
- msg_puts_attr(_(w_readonly), HL_ATTR(HLF_W) | MSG_HIST);
+ msg_puts_hl(_(w_readonly), HLF_W + 1, true);
set_vim_var_string(VV_WARNINGMSG, _(w_readonly), -1);
msg_clr_eos();
msg_end();
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index 8d1f87cbcf..b64e4f3ab6 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -979,20 +979,19 @@ void ExpandCleanup(expand_T *xp)
/// @param linenr line number of matches to display
/// @param maxlen maximum number of characters in each line
/// @param showtail display only the tail of the full path of a file name
-/// @param dir_attr highlight attribute to use for directory names
static void showmatches_oneline(expand_T *xp, char **matches, int numMatches, int lines, int linenr,
- int maxlen, bool showtail, int dir_attr)
+ int maxlen, bool showtail)
{
char *p;
int lastlen = 999;
for (int j = linenr; j < numMatches; j += lines) {
if (xp->xp_context == EXPAND_TAGS_LISTFILES) {
- msg_outtrans(matches[j], HL_ATTR(HLF_D));
+ msg_outtrans(matches[j], HLF_D + 1, false);
p = matches[j] + strlen(matches[j]) + 1;
msg_advance(maxlen + 1);
msg_puts(p);
msg_advance(maxlen + 3);
- msg_outtrans_long(p + 2, HL_ATTR(HLF_D));
+ msg_outtrans_long(p + 2, HLF_D + 1);
break;
}
for (int i = maxlen - lastlen; --i >= 0;) {
@@ -1029,7 +1028,7 @@ static void showmatches_oneline(expand_T *xp, char **matches, int numMatches, in
isdir = false;
p = SHOW_MATCH(j);
}
- lastlen = msg_outtrans(p, isdir ? dir_attr : 0);
+ lastlen = msg_outtrans(p, isdir ? HLF_D + 1 : 0, false);
}
if (msg_col > 0) { // when not wrapped around
msg_clr_eos();
@@ -1119,18 +1118,16 @@ int showmatches(expand_T *xp, bool wildmenu)
lines = (numMatches + columns - 1) / columns;
}
- int attr = HL_ATTR(HLF_D); // find out highlighting for directories
-
if (xp->xp_context == EXPAND_TAGS_LISTFILES) {
- msg_puts_attr(_("tagname"), HL_ATTR(HLF_T));
+ msg_puts_hl(_("tagname"), HLF_T + 1, false);
msg_clr_eos();
msg_advance(maxlen - 3);
- msg_puts_attr(_(" kind file\n"), HL_ATTR(HLF_T));
+ msg_puts_hl(_(" kind file\n"), HLF_T + 1, false);
}
// list the files line by line
for (int i = 0; i < lines; i++) {
- showmatches_oneline(xp, matches, numMatches, lines, i, maxlen, showtail, attr);
+ showmatches_oneline(xp, matches, numMatches, lines, i, maxlen, showtail);
if (got_int) {
got_int = false;
break;
diff --git a/src/nvim/cmdhist.c b/src/nvim/cmdhist.c
index fc3382f486..5993eefd67 100644
--- a/src/nvim/cmdhist.c
+++ b/src/nvim/cmdhist.c
@@ -667,7 +667,7 @@ void ex_history(exarg_T *eap)
} else {
xstrlcpy(IObuff + len, hist[i].hisstr, (size_t)(IOSIZE - len));
}
- msg_outtrans(IObuff, 0);
+ msg_outtrans(IObuff, 0, false);
}
if (i == idx) {
break;
diff --git a/src/nvim/decoration_defs.h b/src/nvim/decoration_defs.h
index 49dc4f9168..58ba93a7ba 100644
--- a/src/nvim/decoration_defs.h
+++ b/src/nvim/decoration_defs.h
@@ -55,7 +55,7 @@ typedef struct {
schar_T conceal_char;
} DecorHighlightInline;
-#define DECOR_HIGHLIGHT_INLINE_INIT { 0, DECOR_PRIORITY_BASE, 0, 0 }
+#define DECOR_HIGHLIGHT_INLINE_INIT { 0, DECOR_PRIORITY_BASE, 0, 0 }
typedef struct {
uint16_t flags;
diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c
index 7413d33fe4..97b47a5ee7 100644
--- a/src/nvim/digraph.c
+++ b/src/nvim/digraph.c
@@ -1707,7 +1707,7 @@ static void digraph_header(const char *msg)
if (msg_col > 0) {
msg_putchar('\n');
}
- msg_outtrans(msg, HL_ATTR(HLF_CM));
+ msg_outtrans(msg, HLF_CM + 1, false);
msg_putchar('\n');
}
@@ -1861,7 +1861,7 @@ static void printdigraph(const digr_T *dp, result_T *previous)
*p++ = (char)dp->char2;
*p++ = ' ';
*p = NUL;
- msg_outtrans(buf, 0);
+ msg_outtrans(buf, 0, false);
p = buf;
// add a space to draw a composing char on
@@ -1871,14 +1871,14 @@ static void printdigraph(const digr_T *dp, result_T *previous)
p += utf_char2bytes(dp->result, p);
*p = NUL;
- msg_outtrans(buf, HL_ATTR(HLF_8));
+ msg_outtrans(buf, HLF_8 + 1, false);
p = buf;
if (char2cells(dp->result) == 1) {
*p++ = ' ';
}
assert(p >= buf);
vim_snprintf(p, sizeof(buf) - (size_t)(p - buf), " %3d", dp->result);
- msg_outtrans(buf, 0);
+ msg_outtrans(buf, 0, false);
}
/// Get the two digraph characters from a typval.
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c
index aa5c66465b..b5e2f4461b 100644
--- a/src/nvim/drawscreen.c
+++ b/src/nvim/drawscreen.c
@@ -952,7 +952,7 @@ int showmode(void)
// Position on the last line in the window, column 0
msg_pos_mode();
- int attr = HL_ATTR(HLF_CM); // Highlight mode
+ int hl_id = HLF_CM + 1; // Highlight mode
// When the screen is too narrow to show the entire mode message,
// avoid scrolling and truncate instead.
@@ -961,7 +961,7 @@ int showmode(void)
lines_left = 0;
if (do_mode) {
- msg_puts_attr("--", attr);
+ msg_puts_hl("--", hl_id, false);
// CTRL-X in Insert mode
if (edit_submode != NULL && !shortmess(SHM_COMPLETIONMENU)) {
// These messages can get long, avoid a wrap in a narrow window.
@@ -981,52 +981,49 @@ int showmode(void)
}
if (length - vim_strsize(edit_submode) > 0) {
if (edit_submode_pre != NULL) {
- msg_puts_attr(edit_submode_pre, attr);
+ msg_puts_hl(edit_submode_pre, hl_id, false);
}
- msg_puts_attr(edit_submode, attr);
+ msg_puts_hl(edit_submode, hl_id, false);
}
if (edit_submode_extra != NULL) {
- msg_puts_attr(" ", attr); // Add a space in between.
- int sub_attr = edit_submode_highl < HLF_COUNT
- ? win_hl_attr(curwin, (int)edit_submode_highl)
- : attr;
- msg_puts_attr(edit_submode_extra, sub_attr);
+ msg_puts_hl(" ", hl_id, false); // Add a space in between.
+ int sub_id = edit_submode_highl < HLF_COUNT ? (int)edit_submode_highl + 1 : hl_id;
+ msg_puts_hl(edit_submode_extra, sub_id, false);
}
}
} else {
if (State & MODE_TERMINAL) {
- msg_puts_attr(_(" TERMINAL"), attr);
+ msg_puts_hl(_(" TERMINAL"), hl_id, false);
} else if (State & VREPLACE_FLAG) {
- msg_puts_attr(_(" VREPLACE"), attr);
+ msg_puts_hl(_(" VREPLACE"), hl_id, false);
} else if (State & REPLACE_FLAG) {
- msg_puts_attr(_(" REPLACE"), attr);
+ msg_puts_hl(_(" REPLACE"), hl_id, false);
} else if (State & MODE_INSERT) {
if (p_ri) {
- msg_puts_attr(_(" REVERSE"), attr);
+ msg_puts_hl(_(" REVERSE"), hl_id, false);
}
- msg_puts_attr(_(" INSERT"), attr);
+ msg_puts_hl(_(" INSERT"), hl_id, false);
} else if (restart_edit == 'I' || restart_edit == 'i'
|| restart_edit == 'a' || restart_edit == 'A') {
if (curbuf->terminal) {
- msg_puts_attr(_(" (terminal)"), attr);
+ msg_puts_hl(_(" (terminal)"), hl_id, false);
} else {
- msg_puts_attr(_(" (insert)"), attr);
+ msg_puts_hl(_(" (insert)"), hl_id, false);
}
} else if (restart_edit == 'R') {
- msg_puts_attr(_(" (replace)"), attr);
+ msg_puts_hl(_(" (replace)"), hl_id, false);
} else if (restart_edit == 'V') {
- msg_puts_attr(_(" (vreplace)"), attr);
+ msg_puts_hl(_(" (vreplace)"), hl_id, false);
}
if (State & MODE_LANGMAP) {
if (curwin->w_p_arab) {
- msg_puts_attr(_(" Arabic"), attr);
- } else if (get_keymap_str(curwin, " (%s)",
- NameBuff, MAXPATHL)) {
- msg_puts_attr(NameBuff, attr);
+ msg_puts_hl(_(" Arabic"), hl_id, false);
+ } else if (get_keymap_str(curwin, " (%s)", NameBuff, MAXPATHL)) {
+ msg_puts_hl(NameBuff, hl_id, false);
}
}
if ((State & MODE_INSERT) && p_paste) {
- msg_puts_attr(_(" (paste)"), attr);
+ msg_puts_hl(_(" (paste)"), hl_id, false);
}
if (VIsual_active) {
@@ -1050,9 +1047,9 @@ int showmode(void)
default:
p = N_(" SELECT BLOCK"); break;
}
- msg_puts_attr(_(p), attr);
+ msg_puts_hl(_(p), hl_id, false);
}
- msg_puts_attr(" --", attr);
+ msg_puts_hl(" --", hl_id, false);
}
need_clear = true;
@@ -1060,7 +1057,7 @@ int showmode(void)
if (reg_recording != 0
&& edit_submode == NULL // otherwise it gets too long
) {
- recording_mode(attr);
+ recording_mode(hl_id);
need_clear = true;
}
@@ -1136,7 +1133,7 @@ void clearmode(void)
msg_ext_ui_flush();
msg_pos_mode();
if (reg_recording != 0) {
- recording_mode(HL_ATTR(HLF_CM));
+ recording_mode(HLF_CM + 1);
}
msg_clr_eos();
msg_ext_flush_showmode();
@@ -1145,16 +1142,16 @@ void clearmode(void)
msg_row = save_msg_row;
}
-static void recording_mode(int attr)
+static void recording_mode(int hl_id)
{
if (shortmess(SHM_RECORDING)) {
return;
}
- msg_puts_attr(_("recording"), attr);
+ msg_puts_hl(_("recording"), hl_id, false);
char s[4];
snprintf(s, ARRAY_SIZE(s), " @%c", reg_recording);
- msg_puts_attr(s, attr);
+ msg_puts_hl(s, hl_id, false);
}
#define COL_RULER 17 // columns needed by standard ruler
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 58c98c42ff..1fb7666167 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -126,7 +126,7 @@ bool *eval_lavars_used = NULL;
#define SCRIPT_SV(id) (SCRIPT_ITEM(id)->sn_vars)
#define SCRIPT_VARS(id) (SCRIPT_SV(id)->sv_dict.dv_hashtab)
-static int echo_attr = 0; // attributes used for ":echo"
+static int echo_hl_id = 0; // highlight id used for ":echo"
/// Info used by a ":for" loop.
typedef struct {
@@ -7876,12 +7876,12 @@ void ex_echo(exarg_T *eap)
msg_start();
}
} else if (eap->cmdidx == CMD_echo) {
- msg_puts_attr(" ", echo_attr);
+ msg_puts_hl(" ", echo_hl_id, false);
}
char *tofree = encode_tv2echo(&rettv, NULL);
if (*tofree != NUL) {
msg_ext_set_kind("echo");
- msg_multiline(tofree, echo_attr, true, &need_clear);
+ msg_multiline(tofree, echo_hl_id, true, false, &need_clear);
}
xfree(tofree);
}
@@ -7907,13 +7907,13 @@ void ex_echo(exarg_T *eap)
/// ":echohl {name}".
void ex_echohl(exarg_T *eap)
{
- echo_attr = syn_name2attr(eap->arg);
+ echo_hl_id = syn_name2id(eap->arg);
}
-/// Returns the :echo attribute
-int get_echo_attr(void)
+/// Returns the :echo highlight id
+int get_echo_hl_id(void)
{
- return echo_attr;
+ return echo_hl_id;
}
/// ":execute expr1 ..." execute the result of an expression.
@@ -7964,7 +7964,7 @@ void ex_execute(exarg_T *eap)
if (ret != FAIL && ga.ga_data != NULL) {
if (eap->cmdidx == CMD_echomsg) {
msg_ext_set_kind("echomsg");
- msg(ga.ga_data, echo_attr);
+ msg(ga.ga_data, echo_hl_id);
} else if (eap->cmdidx == CMD_echoerr) {
// We don't want to abort following commands, restore did_emsg.
int save_did_emsg = did_emsg;
diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c
index d3f836f7f4..35ad00f373 100644
--- a/src/nvim/eval/vars.c
+++ b/src/nvim/eval/vars.c
@@ -1407,7 +1407,7 @@ static void list_one_var_a(const char *prefix, const char *name, const ptrdiff_t
msg_start();
msg_puts(prefix);
if (name != NULL) { // "a:" vars don't have a name stored
- msg_puts_len(name, name_len, 0);
+ msg_puts_len(name, name_len, 0, false);
}
msg_putchar(' ');
msg_advance(22);
@@ -1429,7 +1429,7 @@ static void list_one_var_a(const char *prefix, const char *name, const ptrdiff_t
msg_putchar(' ');
}
- msg_outtrans(string, 0);
+ msg_outtrans(string, 0, false);
if (type == VAR_FUNC || type == VAR_PARTIAL) {
msg_puts("()");
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 834370afe5..a143dc6e49 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -189,7 +189,7 @@ void do_ascii(exarg_T *eap)
transchar(c), buf1, buf2, cval, cval, cval);
}
- msg_multiline(IObuff, 0, true, &need_clear);
+ msg_multiline(IObuff, 0, true, false, &need_clear);
off += (size_t)utf_ptr2len(data); // needed for overlong ascii?
}
@@ -224,7 +224,7 @@ void do_ascii(exarg_T *eap)
c, c, c);
}
- msg_multiline(IObuff, 0, true, &need_clear);
+ msg_multiline(IObuff, 0, true, false, &need_clear);
off += (size_t)utf_ptr2len(data + off); // needed for overlong ascii?
}
@@ -1028,7 +1028,7 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
msg_start();
msg_putchar(':');
msg_putchar('!');
- msg_outtrans(newcmd, 0);
+ msg_outtrans(newcmd, 0, false);
msg_clr_eos();
ui_cursor_goto(msg_row, msg_col);
@@ -1469,7 +1469,7 @@ void print_line_no_prefix(linenr_T lnum, int use_number, bool list)
if (curwin->w_p_nu || use_number) {
vim_snprintf(numbuf, sizeof(numbuf), "%*" PRIdLINENR " ",
number_width(curwin), lnum);
- msg_puts_attr(numbuf, HL_ATTR(HLF_N)); // Highlight line nrs.
+ msg_puts_hl(numbuf, HLF_N + 1, false); // Highlight line nrs.
}
msg_prt_line(ml_get(lnum), list);
}
@@ -3805,7 +3805,7 @@ static int do_sub(exarg_T *eap, const proftime_T timeout, const int cmdpreview_n
msg_no_more = true;
msg_ext_set_kind("confirm_sub");
// Same highlight as wait_return().
- smsg(HL_ATTR(HLF_R), _("replace with %s (y/n/a/q/l/^E/^Y)?"), sub);
+ smsg(HLF_R + 1, _("replace with %s (y/n/a/q/l/^E/^Y)?"), sub);
msg_no_more = false;
msg_scroll = i;
if (!ui_has(kUIMessages)) {
@@ -4796,7 +4796,7 @@ void ex_oldfiles(exarg_T *eap)
if (!message_filtered(fname)) {
msg_outnum(nr);
msg_puts(": ");
- msg_outtrans(tv_get_string(TV_LIST_ITEM_TV(li)), 0);
+ msg_outtrans(tv_get_string(TV_LIST_ITEM_TV(li)), 0, false);
msg_clr_eos();
msg_putchar('\n');
os_breakcheck();
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index aff9dce7c1..0ff4282884 100644
--- a/