diff options
author | bfredl <bjorn.linse@gmail.com> | 2022-12-20 22:20:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-20 22:20:17 +0100 |
commit | a6747545be8371e53f16189219ec3950d4b219f7 (patch) | |
tree | 2afcd09f7cfa03394448b9e8009f7a6ecbe8ec3a /src/nvim/api/vim.c | |
parent | 45d1b1c6788a5694850361b5ffa95d63eb75b2f5 (diff) | |
parent | b42d8a43b9f1b3316e73108ebefc4850b1a2c65b (diff) | |
download | rneovim-a6747545be8371e53f16189219ec3950d4b219f7.tar.gz rneovim-a6747545be8371e53f16189219ec3950d4b219f7.tar.bz2 rneovim-a6747545be8371e53f16189219ec3950d4b219f7.zip |
Merge pull request #21441 from bfredl/neoterminfo
refactor(tui): use nvim_echo() for verbose terminfo
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r-- | src/nvim/api/vim.c | 19 |
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; |