[patch] xterm title bar fix



Hi,

there is a small annoying issue with the xterm title setting. As xterm (original XFree) honors also the setting of the charset, the title sometimes displays garbage, because the charset remained set to line drawing characters. A simple way to reproduce this bug is pressing F9 ESC ESC.

The attached patch fixes the issue for mc compiled with Slang, by using Slang text output functions instead of fprintf. I don't know how to fix this in ncurses version, if it is affected at all. Note that putting additional \17 to printf string alone doesn't help because slang isn't aware of such charset change, so it sometimes prints frames using letters instead.

Regards,
--
Jindrich Makovicka
--- main.c.orig	2005-02-08 22:34:26.000000000 +0100
+++ main.c	2005-02-14 16:39:48.000000000 +0100
@@ -1604,7 +1604,7 @@
 void
 update_xterm_title_path (void)
 {
-    unsigned char *p, *s;
+    unsigned char *p, *s, *tmp;
 
     if (xterm_flag && xterm_title) {
 	p = s = g_strdup (strip_home_and_password (current_panel->cwd));
@@ -1612,8 +1612,15 @@
 	    if (!is_printable (*s))
 		*s = '?';
 	} while (*++s);
+#ifdef HAVE_SLANG
+	SLtt_set_alt_char_set (0);
+	tmp = g_strdup_printf("\33]0;mc - %s\7", p);
+	SLtt_write_string (tmp);
+	g_free(tmp);
+#else
 	fprintf (stdout, "\33]0;mc - %s\7", p);
 	fflush (stdout);
+#endif
 	g_free (p);
     }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]