aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/vim.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-06-10 11:23:17 +0200
committerbfredl <bjorn.linse@gmail.com>2022-06-11 22:29:51 +0200
commitf4121c52b95d4b79c0de95412c8447614a2f8960 (patch)
tree5f235062bb5f0d0729787ad263b292f40f51f355 /src/nvim/api/vim.c
parentc87a5ebbc31c56867f9d6f6d27bb8b7ddecc837e (diff)
downloadrneovim-f4121c52b95d4b79c0de95412c8447614a2f8960.tar.gz
rneovim-f4121c52b95d4b79c0de95412c8447614a2f8960.tar.bz2
rneovim-f4121c52b95d4b79c0de95412c8447614a2f8960.zip
fix(messages): add color when showing nvim_echo in :messages history
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r--src/nvim/api/vim.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 1e44250ec3..5f7162cdd6 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -942,26 +942,15 @@ void nvim_echo(Array chunks, Boolean history, Dictionary opts, Error *err)
goto error;
}
- no_wait_return++;
- msg_start();
- msg_clr_eos();
- bool need_clear = false;
- for (uint32_t i = 0; i < kv_size(hl_msg); i++) {
- HlMessageChunk chunk = kv_A(hl_msg, i);
- msg_multiline_attr((const char *)chunk.text.data, chunk.attr,
- true, &need_clear);
- }
+ msg_multiattr(hl_msg, history ? "echomsg" : "echo", history);
+
if (history) {
- msg_ext_set_kind("echomsg");
- add_hl_msg_hist(hl_msg);
- } else {
- msg_ext_set_kind("echo");
+ // history takes ownership
+ return;
}
- no_wait_return--;
- msg_end();
error:
- clear_hl_msg(&hl_msg);
+ hl_msg_free(hl_msg);
}
/// Writes a message to the Vim output buffer. Does not append "\n", the