Improve getXTermFont() and getXTermTitle()
This commit is contained in:
parent
56a6878f46
commit
24e52e968e
|
@ -1,5 +1,6 @@
|
||||||
2015-10-17 Markus Gans <guru.mail@muenster.de>
|
2015-10-17 Markus Gans <guru.mail@muenster.de>
|
||||||
* More faster header inline code
|
* More faster header inline code
|
||||||
|
* Improve getXTermFont() and getXTermTitle()
|
||||||
|
|
||||||
2015-10-16 Markus Gans <guru.mail@muenster.de>
|
2015-10-16 Markus Gans <guru.mail@muenster.de>
|
||||||
* Fixed: calculator behavior for negative values
|
* Fixed: calculator behavior for negative values
|
||||||
|
|
|
@ -1503,6 +1503,7 @@ void FTerm::init()
|
||||||
setNonBlockingInput();
|
setNonBlockingInput();
|
||||||
xterm_font = new FString(getXTermFont());
|
xterm_font = new FString(getXTermFont());
|
||||||
xterm_title = new FString(getXTermTitle());
|
xterm_title = new FString(getXTermTitle());
|
||||||
|
::printf("(%s)",xterm_title->c_str()); fflush(stdout); sleep(2);
|
||||||
unsetNonBlockingInput();
|
unsetNonBlockingInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2674,17 +2675,16 @@ FString FTerm::getXTermFont()
|
||||||
putstring ("\033]50;?\07"); // get font
|
putstring ("\033]50;?\07"); // get font
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
usleep(150000); // wait 150 ms
|
usleep(150000); // wait 150 ms
|
||||||
// read the answer
|
|
||||||
n = int(read(fileno(stdin), &temp, sizeof(temp)-1));
|
|
||||||
// Esc + \ = OSC string terminator
|
|
||||||
if ( n >= 2 && temp[n-1] == '\\' && temp[n-2] == 0x1b )
|
|
||||||
{
|
|
||||||
temp[n-2] = '\0';
|
|
||||||
font = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( font.getLength() > 6 )
|
// read the terminal answer
|
||||||
font = font.mid(6, font.getLength()-1);
|
n = int(read(fileno(stdin), &temp, sizeof(temp)-1));
|
||||||
|
|
||||||
|
// BEL + '\0' = string terminator
|
||||||
|
if ( n >= 6 && temp[n-1] == '\07' && temp[n] == '\0' )
|
||||||
|
{
|
||||||
|
temp[n-1] = '\0';
|
||||||
|
font = static_cast<char*>(temp + 5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
@ -2704,17 +2704,16 @@ FString FTerm::getXTermTitle()
|
||||||
putstring ("\033[21t"); // get title
|
putstring ("\033[21t"); // get title
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
usleep(150000); // wait 150 ms
|
usleep(150000); // wait 150 ms
|
||||||
// read the answer
|
|
||||||
|
// read the terminal answer
|
||||||
n = int(read(fileno(stdin), &temp, sizeof(temp)-1));
|
n = int(read(fileno(stdin), &temp, sizeof(temp)-1));
|
||||||
|
|
||||||
// Esc + \ = OSC string terminator
|
// Esc + \ = OSC string terminator
|
||||||
if ( n >= 2 && temp[n-1] == '\\' && temp[n-2] == 0x1b )
|
if ( n >= 5 && temp[n-1] == '\\' && temp[n-2] == 0x1b )
|
||||||
{
|
{
|
||||||
temp[n-2] = '\0';
|
temp[n-2] = '\0';
|
||||||
title = temp;
|
title = static_cast<char*>(temp + 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( title.getLength() > 3 )
|
|
||||||
title = title.right( title.getLength()-3 );
|
|
||||||
}
|
}
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue