X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Ftext-node.c;h=2b5cad02799a531a9ab5519c40f76da3832d773e;hb=refs%2Ftags%2Fupstream%2F3.2.0;hp=f9dec9cc0cf89b5e649687d7d92464c2df05b485;hpb=cbc5b369069a355c3fa9715c059271d45dbb33e0;p=glabels diff --git a/src/text-node.c b/src/text-node.c index f9dec9cc..2b5cad02 100644 --- a/src/text-node.c +++ b/src/text-node.c @@ -220,6 +220,7 @@ gl_text_node_lines_expand (GList *lines, GList *p_line, *p_node; glTextNode *text_node; gchar *text, *old_text, *expanded_node; + gboolean first_line = TRUE; text = g_strdup (""); /* prime pointer for concatenation */ for (p_line = lines; p_line != NULL; p_line = p_line->next) { @@ -234,6 +235,15 @@ gl_text_node_lines_expand (GList *lines, } } + /* prepend newline if it's not the first line */ + if (!first_line) { + old_text = text; + text = g_strconcat (text, "\n", NULL); + g_free (old_text); + } else { + first_line = FALSE; + } + /* expand each node */ for (p_node = (GList *) p_line->data; p_node != NULL; p_node = p_node->next) { @@ -244,13 +254,6 @@ gl_text_node_lines_expand (GList *lines, g_free (old_text); g_free (expanded_node); } - - /* append newline to each line, except last. */ - if ( p_line->next != NULL ) { - old_text = text; - text = g_strconcat (text, "\n", NULL); - g_free (old_text); - } } return text;