aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/vim.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-12-16 13:50:12 +0100
committerbfredl <bjorn.linse@gmail.com>2022-12-20 21:43:42 +0100
commitb42d8a43b9f1b3316e73108ebefc4850b1a2c65b (patch)
tree408d480448e23225291092952c789888e2b60f25 /src/nvim/api/vim.c
parentf04087d8ba0623d1946eefe0f71d5f3e92d58c14 (diff)
downloadrneovim-b42d8a43b9f1b3316e73108ebefc4850b1a2c65b.tar.gz
rneovim-b42d8a43b9f1b3316e73108ebefc4850b1a2c65b.tar.bz2
rneovim-b42d8a43b9f1b3316e73108ebefc4850b1a2c65b.zip
refactor(tui): use nvim_echo() for verbose terminfo
This is needed for #18375 for the obvious reasons. note: verbose_terminfo_event is only temporarily needed until the full TUI process refactor is merged.
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r--src/nvim/api/vim.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 70b07dabe8..83c9d54725 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -726,8 +726,11 @@ void nvim_set_vvar(String name, Object value, Error *err)
/// text chunk with specified highlight. `hl_group` element
/// can be omitted for no highlight.
/// @param history if true, add to |message-history|.
-/// @param opts Optional parameters. Reserved for future use.
-void nvim_echo(Array chunks, Boolean history, Dictionary opts, Error *err)
+/// @param opts Optional parameters.
+/// - verbose: Message was printed as a result of 'verbose' option
+/// if Nvim was invoked with -V3log_file, the message will be
+/// redirected to the log_file and surpressed from direct output.
+void nvim_echo(Array chunks, Boolean history, Dict(echo_opts) *opts, Error *err)
FUNC_API_SINCE(7)
{
HlMessage hl_msg = parse_hl_msg(chunks, err);
@@ -735,13 +738,19 @@ void nvim_echo(Array chunks, Boolean history, Dictionary opts, Error *err)
goto error;
}
- if (opts.size > 0) {
- api_set_error(err, kErrorTypeValidation, "opts dict isn't empty");
- goto error;
+ bool verbose = api_object_to_bool(opts->verbose, "verbose", false, err);
+
+ if (verbose) {
+ verbose_enter();
}
msg_multiattr(hl_msg, history ? "echomsg" : "echo", history);
+ if (verbose) {
+ verbose_leave();
+ verbose_stop(); // flush now
+ }
+
if (history) {
// history takes ownership
return;