mirror of https://github.com/adamdruppe/arsd.git
16 bit console title
This commit is contained in:
parent
a929982e46
commit
aa50910529
12
terminal.d
12
terminal.d
|
@ -187,7 +187,6 @@ version(Posix) {
|
|||
|
||||
version(Windows) {
|
||||
import core.sys.windows.windows;
|
||||
import std.string : toStringz;
|
||||
private {
|
||||
enum RED_BIT = 4;
|
||||
enum GREEN_BIT = 2;
|
||||
|
@ -1179,7 +1178,16 @@ http://msdn.microsoft.com/en-us/library/windows/desktop/ms683193%28v=vs.85%29.as
|
|||
/// Changes the terminal's title
|
||||
void setTitle(string t) {
|
||||
version(Windows) {
|
||||
SetConsoleTitleA(toStringz(t));
|
||||
wchar[256] buffer;
|
||||
size_t bufferLength;
|
||||
foreach(wchar ch; t)
|
||||
if(bufferLength < buffer.length)
|
||||
buffer[bufferLength++] = ch;
|
||||
if(bufferLength < buffer.length)
|
||||
buffer[bufferLength++] = 0;
|
||||
else
|
||||
buffer[$-1] = 0;
|
||||
SetConsoleTitleW(buffer.ptr);
|
||||
} else {
|
||||
import std.string;
|
||||
if(terminalInFamily("xterm", "rxvt", "screen"))
|
||||
|
|
Loading…
Reference in New Issue