From 201a39d7fafa923eab20a241b23ad2786a64d866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Sun, 20 Oct 2024 22:13:48 +0200 Subject: [PATCH] msg: skip formatting if there is only control char present This doesn't change behaviour just skips some redundant code early. --- common/msg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/msg.c b/common/msg.c index cce143ae03..ef949a8dfc 100644 --- a/common/msg.c +++ b/common/msg.c @@ -539,9 +539,10 @@ static void write_term_msg(struct mp_log *log, int lev, bstr text, bstr *out) if (lev == MSGL_STATUS) { int line_w = 0; + bool clip = bstr_eatstart0(&str, TERM_MSG_0); if (str.len && print_term) append_terminal_line(log, lev, str, &root->term_msg_tmp, &line_w, - bstr_eatstart0(&str, TERM_MSG_0) && term_w ? term_w : INT_MAX); + clip && term_w ? term_w : INT_MAX); term_msg_lines += !term_w ? (str.len ? 1 : 0) : (line_w + term_w - 1) / term_w; } else if (str.len) {