Skip to content

Commit 1752e3c

Browse files
committed
FIX: don't use ANSI color sequence in formed error
1 parent 25aeee3 commit 1752e3c

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/core/a-lib.c

+2
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,9 @@ extern int Do_Callback(REBSER *obj, u32 name, RXIARG *args, RXIARG *result);
478478
// }
479479
} else {
480480
if (VAL_ERR_NUM(top) != RE_HALT) {
481+
Put_Str(b_cast("\x1B[1;35m"));
481482
Out_Value(top, 640, FALSE, 0); // error FORMed
483+
Put_Str(b_cast("\x1B[0m"));
482484
// if (VAL_ERR_NUM(top) > RE_THROW_MAX) {
483485
// Out_Str("** Note: use WHY? for more about this error", 1);
484486
// }

src/core/s-mold.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ STOID Mold_Error(REBVAL *value, REB_MOLD *mold, REBFLG molded)
10461046
err = VAL_ERR_VALUES(value);
10471047

10481048
// Form: ** <type> Error:
1049-
Emit(mold, "\x1B[1;35m** WB", &err->type, RS_ERRS+0);
1049+
Emit(mold, "** WB", &err->type, RS_ERRS+0);
10501050

10511051
// Append: error message ARG1, ARG2, etc.
10521052
msg = Find_Error_Info(err, 0);

src/tests/units/mold-test.r3

+7
Original file line numberDiff line numberDiff line change
@@ -459,4 +459,11 @@ Rebol [
459459

460460
===end-group===
461461

462+
===start-group=== "form error!"
463+
--test-- "form error!"
464+
; no ANSI escape sequence!
465+
--assert (form try [1 / 0]) = {** Math error: attempt to divide by zero^/** Where: / try^/** Near: / 0^/}
466+
467+
===end-group===
468+
462469
~~~end-file~~~

0 commit comments

Comments
 (0)