Skip to content

Commit eb7ba29

Browse files
committed
FIX: MOLD/FLAT on object values does not remove line breaks
Fixes: metaeducation/rebol-issues#2357
1 parent 9e2846c commit eb7ba29

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/core/s-mold.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,7 @@ STOID Mold_Object(REBVAL *value, REB_MOLD *mold)
900900
REBVAL *words;
901901
REBVAL *vals; // first value is context
902902
REBCNT n;
903+
REBOOL indented = !GET_MOPT(mold, MOPT_INDENT);
903904

904905
ASSERT(VAL_OBJ_FRAME(value), RP_NO_OBJECT_FRAME);
905906

@@ -927,7 +928,11 @@ STOID Mold_Object(REBVAL *value, REB_MOLD *mold)
927928
!VAL_GET_OPT(words+n, OPTS_HIDE) &&
928929
((VAL_TYPE(vals+n) > REB_NONE) || !GET_MOPT(mold, MOPT_NO_NONE))
929930
){
930-
New_Indented_Line(mold);
931+
if(indented)
932+
New_Indented_Line(mold);
933+
else if (n > 1)
934+
Append_Byte(mold->series, ' ');
935+
931936
Append_UTF8(mold->series, Get_Sym_Name(VAL_WORD_SYM(words+n)), -1);
932937
//Print("Slot: %s", Get_Sym_Name(VAL_WORD_SYM(words+n)));
933938
Append_Bytes(mold->series, ": ");
@@ -936,7 +941,7 @@ STOID Mold_Object(REBVAL *value, REB_MOLD *mold)
936941
}
937942
}
938943
mold->indent--;
939-
New_Indented_Line(mold);
944+
if (indented) New_Indented_Line(mold);
940945
Append_Byte(mold->series, ']');
941946

942947
End_Mold(mold);

0 commit comments

Comments
 (0)