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.
This commit is contained in:
Lennart Poettering
2025-12-24 08:00:39 +01:00
committed by Daan De Meyer
parent 22eb3a6bd9
commit ceaa36c21e

View File

@@ -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)