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.
This commit is contained in:
bfredl
2022-12-16 13:50:12 +01:00
parent f04087d8ba
commit b42d8a43b9
10 changed files with 140 additions and 59 deletions

View File

@@ -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;