Skip to content

Commit bd91b59

Browse files
committed
FIX: mold emitting invisible chars in some cases
resolves: Oldes/Rebol-issues#2562
1 parent d423e91 commit bd91b59

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/core/s-mold.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ STOID Sniff_String(REBSER *ser, REBCNT idx, REB_STRF *sf)
326326
static REBUNI *Emit_Uni_Char(REBUNI *up, REBUNI chr, REBOOL parened)
327327
{
328328
if (chr >= 0x7f || chr == 0x1e) { // non ASCII or ^ must be (00) escaped
329-
if (parened || chr == 0x1e) { // do not AND with above
329+
if (parened || chr <= 0xA0 || chr == 0x1e) { // do not AND with above
330330
*up++ = '^';
331331
*up++ = '(';
332332
up = Form_Uni_Hex(up, chr);

src/tests/units/mold-test.r3

+9
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,15 @@ Rebol [
220220
===end-group===
221221

222222

223+
===start-group=== "mold char!"
224+
--test-- "mold invisible chars"
225+
;@@ https://github.com/Oldes/Rebol-issues/issues/2562
226+
for i 127 160 1 [
227+
--assert all [8 = length? v: mold to char! i v/4 = #"("]
228+
]
229+
===end-group===
230+
231+
223232
===start-group=== "mold-all"
224233

225234
--test-- "mold-true" --assert "true" = mold true

0 commit comments

Comments
 (0)