16 bit console title

This commit is contained in:
Adam D. Ruppe 2020-01-23 14:51:06 -05:00
parent a929982e46
commit aa50910529
1 changed files with 10 additions and 2 deletions

View File

@ -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"))