added forced line break support to auto-wrapped text output
authorHolger Schemel <info@artsoft.org>
Wed, 14 Dec 2022 22:53:21 +0000 (23:53 +0100)
committerHolger Schemel <info@artsoft.org>
Wed, 14 Dec 2022 22:58:05 +0000 (23:58 +0100)
To add a line break to auto-wrapped text output (like level set info
text files), use two spaces at the end of a line (like it is used in
Markdown formatted text).

src/libgame/text.c

index ce855daf9604496ddc89287ae8cade95676f37b7..4de7319a7e131a6bf4a996cac727f5caaa506e40 100644 (file)
@@ -404,6 +404,9 @@ static boolean RenderLineToBuffer(char **src_buffer_ptr, char *dst_buffer,
     char *word_ptr;
     int word_len;
 
     char *word_ptr;
     int word_len;
 
+    if (strEqual(text_ptr, "  "))      // special case: force line break
+      buffer_filled = TRUE;
+
     // skip leading whitespaces
     while (*text_ptr == ' ' || *text_ptr == '\t')
       text_ptr++;
     // skip leading whitespaces
     while (*text_ptr == ' ' || *text_ptr == '\t')
       text_ptr++;