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;
--
1.8.4
_______________________________________________
mpd-devel mailing list
[email protected]
http://mailman.blarg.de/listinfo/mpd-devel