From 816478313069b2bac69cb4cd9617f0afb2182813 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 f6cfbeb72a97a..6d2f3151c88ca 100644 --- a/common/msg.c +++ b/common/msg.c @@ -533,9 +533,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) {