From ceaa36c21e89aac1d9370b804ee74223bd96f943 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 24 Dec 2025 08:00:39 +0100 Subject: [PATCH] terminal-util: use the right ANSI ST sequence There are multiple ways to encode ANSI ST, and we generally prefer ESC \ for it, for reasons explained in terminal-util.h. Hence, let's actually follow this rule in the terminal reset logic, and use the ANSI_ST macro. This will change the byte sequence generated (as it means we use ESC \ rather than BEL), but it doesn't change behaviour, as the two sequences should be equivalent. --- src/basic/terminal-util.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c index ce3a76bdd00..01c2bd37505 100644 --- a/src/basic/terminal-util.c +++ b/src/basic/terminal-util.c @@ -968,12 +968,12 @@ int terminal_reset_ansi_seq(int fd) { return log_debug_errno(r, "Failed to set terminal to non-blocking mode: %m"); k = loop_write_full(fd, - "\033[!p" /* soft terminal reset */ - "\033]104\007" /* reset colors via OSC104 */ - ANSI_NORMAL /* reset colors */ - "\033[?7h" /* enable line-wrapping */ - "\033[1G" /* place cursor at beginning of current line */ - "\033[0J", /* erase till end of screen */ + "\033[!p" /* soft terminal reset */ + ANSI_OSC "104" ANSI_ST /* reset color palette via OSC 104 */ + ANSI_NORMAL /* reset colors */ + "\033[?7h" /* enable line-wrapping */ + "\033[1G" /* place cursor at beginning of current line */ + "\033[0J", /* erase till end of screen */ SIZE_MAX, 100 * USEC_PER_MSEC); if (k < 0) -- 2.47.3