Skip to content

Commit

Permalink
FIX: don't use ANSI color sequence in formed error
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Dec 1, 2020
1 parent 25aeee3 commit 1752e3c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/core/a-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,9 @@ extern int Do_Callback(REBSER *obj, u32 name, RXIARG *args, RXIARG *result);
// }
} else {
if (VAL_ERR_NUM(top) != RE_HALT) {
Put_Str(b_cast("\x1B[1;35m"));
Out_Value(top, 640, FALSE, 0); // error FORMed
Put_Str(b_cast("\x1B[0m"));
// if (VAL_ERR_NUM(top) > RE_THROW_MAX) {
// Out_Str("** Note: use WHY? for more about this error", 1);
// }
Expand Down
2 changes: 1 addition & 1 deletion src/core/s-mold.c
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ STOID Mold_Error(REBVAL *value, REB_MOLD *mold, REBFLG molded)
err = VAL_ERR_VALUES(value);

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

// Append: error message ARG1, ARG2, etc.
msg = Find_Error_Info(err, 0);
Expand Down
7 changes: 7 additions & 0 deletions src/tests/units/mold-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -459,4 +459,11 @@ Rebol [

===end-group===

===start-group=== "form error!"
--test-- "form error!"
; no ANSI escape sequence!
--assert (form try [1 / 0]) = {** Math error: attempt to divide by zero^/** Where: / try^/** Near: / 0^/}

===end-group===

~~~end-file~~~

0 comments on commit 1752e3c

Please sign in to comment.