From 369b13a2af81efe79f1dde1ccebedd7a7b049b80 Mon Sep 17 00:00:00 2001 From: noname Date: Fri, 25 Apr 2014 18:48:38 +0400 Subject: [PATCH] Flush stdout to change xterm title. If stdout is not flushed, printf may not terminate control string properly. This way xterm title changes only sometimes. Also use standard (ECMA-048) control string terminator ^[\ instead of \a. --- src/screen_utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/screen_utils.c b/src/screen_utils.c index 1c1f14b..4bb1875 100644 --- a/src/screen_utils.c +++ b/src/screen_utils.c @@ -170,7 +170,8 @@ set_xterm_title(const char *format, ...) va_start(ap,format); char *msg = g_strdup_vprintf(format,ap); va_end(ap); - printf("%c]0;%s%c", '\033', msg, '\007'); + printf("\033]0;%s\033\\", msg); + fflush(stdout); g_free(msg); } else options.enable_xterm_title = FALSE; -- 2.30.2