xterm_title patch 898

Tomas Styblo tripie at cpan.org
Tue Jan 7 08:02:53 UTC 2003


* Thomas Zajic <zlatko at gmx.at> [Tue, 07 Jan 2003]:
> Now that's strange, because AFAICT it _does_ report the proper title, or
> at least mc is _somehow_ able to restore it upon exit. Do you have some
> fallback(s) in place to get the title, ie. something other than what you
> are trying to do within the 5 seconds?

Well maybe there is a bug in the code and I just can't see it, but
it works for me.

seen_esc = 0;
while (i < sizeof(title) && read(tty, &ch, 1) > 0) {
    
    /* read and discard characters until we get the ESC character
       which starts the title response of the terminal */
    
    if (seen_esc == 0) { 
        if (ch == '\033') 
            seen_esc = 1;
        else    
            continue;
    }       
    
    /* This character terminates the title response
       according to the xterm control sequence specification.
       Stop reading - this should prevent the delay */
    if (ch == '\x9c')  /* ST */
        break;

    /* append a character of the title response to the buffer */
    title[i++] = ch;
}       


-- 
Tomas Styblo <tripie at cpan.org>
PGP: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC97EA4B6



More information about the mc-devel mailing list