aboutsummaryrefslogtreecommitdiff
path: root/src/sc_interp.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2016-03-29 22:09:52 +0200
committerThomas White <taw@bitwiz.org.uk>2016-03-29 22:09:52 +0200
commitd7ee6bba4f775abb09836cddf1dd6a7cda5f04db (patch)
tree6c1c03b0efb0fca48d667876b917d9ca31340daf /src/sc_interp.c
parent3df20774824245fe3d1ec8451f2a664dd3b8569d (diff)
Allow empty paragraphs
Needed so the user can add extra line breaks for formatting.
Diffstat (limited to 'src/sc_interp.c')
-rw-r--r--src/sc_interp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/sc_interp.c b/src/sc_interp.c
index 943afd3..9899a95 100644
--- a/src/sc_interp.c
+++ b/src/sc_interp.c
@@ -820,6 +820,7 @@ static int add_text(struct frame *fr, PangoContext *pc, SCBlock *bl,
size_t start, len_bytes;
PangoFontDescription *fontdesc;
double *col;
+ int just_closed = 0;
/* Empty block? */
if ( text == NULL ) return 1;
@@ -846,12 +847,18 @@ static int add_text(struct frame *fr, PangoContext *pc, SCBlock *bl,
}
if ( text[start] == '\n' ) {
+ if ( just_closed ) {
+ Paragraph *para = last_open_para(fr);
+ add_run(para, bl, start, 0, fontdesc, col);
+ }
close_last_paragraph(fr);
start += 1;
+ just_closed = 1;
} else {
Paragraph *para = last_open_para(fr);
add_run(para, bl, start, len, fontdesc, col);
start += len;
+ just_closed = 0;
}
} while ( start < len_bytes );