Skip to content

Commit f76852c

Browse files
committed
FIX: ANSI colors are used, where are not expected.
1 parent 97a0f46 commit f76852c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/os/win32/dev-stdio.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,11 @@ static void close_stdio(void)
289289
ep = bp + req->length;
290290

291291
do {
292-
cp = Skip_To_Char(bp, ep, (REBYTE)27); //find ANSI escape char "^["
292+
//from some reason, I must decrement the tail pointer in function bellow,
293+
//else escape char is found past the end and processed in rare cases - like in console: do [help] do [help func]
294+
//It looks dangerous, but it should be safe as it looks the req->length is always at least 1.
295+
cp = Skip_To_Char(bp, ep-1, (REBYTE)27); //find ANSI escape char "^["
296+
293297
//if found, write to the console content before it starts, else everything
294298
if (cp){
295299
len = MultiByteToWideChar(CP_UTF8, 0, bp, cp - bp, Std_Buf, BUF_SIZE);

0 commit comments

Comments
 (0)