xterm title in the prompt

Lukasz Stelmach lukasz.stelmach at telmark.waw.pl
Fri Oct 26 12:28:44 UTC 2007


Greetings.

There is a problem in with mc trying to display bash prompt
for xterm which contains window title

        PS1='\[\033[?1034l\033]0;\h:\w\007\]\h:\W\$ '

That is everything between \033]0; and \007. The patch removes
this sequence.

---
diff -uNrp mc-4.6.1-orig/src/util.c mc-4.6.1/src/util.c
--- mc-4.6.1-orig/src/util.c	2005-05-27 16:19:18.000000000 +0200
+++ mc-4.6.1/src/util.c	2007-02-12 15:49:11.234831267 +0100
@@ -890,7 +890,8 @@ char *strip_ctrl_codes (char *s)
 	    if (*(++r) == '[') {
 		/* strchr() matches trailing binary 0 */
 		while (*(++r) && strchr ("0123456789;?", *r));
-	    }
+	    } else if (!strncmp("]0;",r,3)) /* Skip xterm title */
+		while (*r != '\007' && *r != '\0') r++;
 
 	    /*
 	     * Now we are at the last character of the sequence.
---

Please CC. I'am not subscribed.
-- 
Miłego dnia
>Łukasz<



More information about the mc-devel mailing list