Commit bbbd019c authored by Youness Alaoui's avatar Youness Alaoui
Browse files

Fix newlines received as argument with '\n' in them

parent 99efc547
......@@ -347,17 +347,24 @@ load_text_from_file (char *filename)
void
create_text_suface (Menu *menu, char *text)
{
char *ptr;
int filesize;
int lines;
char *ptr, *ptr2;
int filesize;
int lines;
memset (&menu->text, 0, sizeof(MenuText));
/* Calculate number of lines */
lines = 0;
ptr = text;
ptr = ptr2 = text;
while (*ptr != 0) {
if (*ptr++ == '\n')
if (*ptr == '\\' && ptr[1] == 'n') {
*ptr2 = '\n';
ptr += 2;
} else {
*ptr2 = *ptr;
ptr++;
}
if (*ptr2++ == '\n')
lines++;
}
/* Last line */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment