From 3e499ff3bc3cdd668efc41974c8cdd64d9a99178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Fri, 18 Oct 2024 00:18:50 +0200 Subject: [PATCH] msg: fix width with ellipsis Fixes: 6aa331289f10b12622fadc1589092276d30296aa --- common/msg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/msg.c b/common/msg.c index ce7bc9b283..8bdb4250ff 100644 --- a/common/msg.c +++ b/common/msg.c @@ -396,8 +396,9 @@ static void append_terminal_line(struct mp_log *log, int lev, bstr_xappend(root, term_msg, text); const unsigned char *cut_pos = NULL; + int ellipsis_width = 1; int width = term_disp_width(bstr_splice(*term_msg, start, term_msg->len), - term_w - 1, &cut_pos); + term_w - ellipsis_width, &cut_pos); if (cut_pos) { int new_len = cut_pos - term_msg->start; bstr rem = {(unsigned char *)cut_pos, term_msg->len - new_len}; @@ -419,7 +420,7 @@ static void append_terminal_line(struct mp_log *log, int lev, } bstr_xappend(root, term_msg, bstr0("\n")); - width += 3; + width += ellipsis_width; } *line_w = root->isatty[term_msg_fileno(root, lev)] ? width : 0;