Skip to content

Commit

Permalink
FIX: ANSI colors are used, where are not expected.
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Jul 15, 2014
1 parent 97a0f46 commit f76852c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/os/win32/dev-stdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,11 @@ static void close_stdio(void)
ep = bp + req->length;

do {
cp = Skip_To_Char(bp, ep, (REBYTE)27); //find ANSI escape char "^["
//from some reason, I must decrement the tail pointer in function bellow,
//else escape char is found past the end and processed in rare cases - like in console: do [help] do [help func]
//It looks dangerous, but it should be safe as it looks the req->length is always at least 1.
cp = Skip_To_Char(bp, ep-1, (REBYTE)27); //find ANSI escape char "^["

//if found, write to the console content before it starts, else everything
if (cp){
len = MultiByteToWideChar(CP_UTF8, 0, bp, cp - bp, Std_Buf, BUF_SIZE);
Expand Down

0 comments on commit f76852c

Please sign in to comment.