From 67bac681ea6b38b458ad0b7b10f2a9dce85baef0 Mon Sep 17 00:00:00 2001 From: Alexandre Dubray Date: Sat, 17 Feb 2018 22:31:24 +0100 Subject: ex_echo: reuse code from message.c to show arg to user --- src/nvim/eval.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'src/nvim/eval.c') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 596eff5b79..3a18a9492f 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -19593,24 +19593,7 @@ void ex_echo(exarg_T *eap) msg_puts_attr(" ", echo_attr); } char *tofree = encode_tv2echo(&rettv, NULL); - const char *p = tofree; - if (p != NULL) { - for (; *p != NUL && !got_int; ++p) { - if (*p == '\n' || *p == '\r' || *p == TAB) { - if (*p != TAB && needclr) { - /* remove any text still there from the command */ - msg_clr_eos(); - needclr = false; - } - msg_putchar_attr((uint8_t)(*p), echo_attr); - } else { - int i = (*mb_ptr2len)((const char_u *)p); - - (void)msg_outtrans_len_attr((char_u *)p, i, echo_attr); - p += i - 1; - } - } - } + msg_echo_show(tofree, echo_attr); xfree(tofree); } tv_clear(&rettv); -- cgit From 27b78130252be59416f0ce29111e59a2de99b93e Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Fri, 18 Jan 2019 12:16:58 +0100 Subject: cleanup: reduce some duplicate code, avoid function pointers for a condition Add 'multiline' flag to history for correct :messages output Use larger buffer size for multiline messages. if this turns out to not be enough, we could do size calculation like api_set_error --- src/nvim/eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/eval.c') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 3a18a9492f..1c6fb5d2f8 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -19593,7 +19593,7 @@ void ex_echo(exarg_T *eap) msg_puts_attr(" ", echo_attr); } char *tofree = encode_tv2echo(&rettv, NULL); - msg_echo_show(tofree, echo_attr); + msg_multiline_attr(tofree, echo_attr); xfree(tofree); } tv_clear(&rettv); -- cgit