aboutsummaryrefslogtreecommitdiff
path: root/src/sc_interp.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2018-03-16 17:28:41 +0100
committerThomas White <taw@physics.org>2018-03-18 14:27:46 +0100
commit0cf5b0a52dfc1134806c56fdd9940d9e2a564cc8 (patch)
tree423da7c3cea3edb4e7d306229e43fde565b5ec76 /src/sc_interp.c
parenta1b7013fda7329aa6caadeb0f2ecf28b4c332a05 (diff)
Set scblock/rscblock even for text paragraphs
It's needed as a hook if there are no runs
Diffstat (limited to 'src/sc_interp.c')
-rw-r--r--src/sc_interp.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/sc_interp.c b/src/sc_interp.c
index d827326..0301aad 100644
--- a/src/sc_interp.c
+++ b/src/sc_interp.c
@@ -943,7 +943,7 @@ static int in_macro(SCInterpreter *scin)
}
-static void add_newpara(struct frame *fr, SCBlock *bl)
+static void add_newpara(struct frame *fr, SCBlock *bl, SCBlock *mrb)
{
Paragraph *last_para;
@@ -952,7 +952,9 @@ static void add_newpara(struct frame *fr, SCBlock *bl)
set_newline_at_end(last_para, bl);
- create_paragraph(fr);
+ /* The block after the \newpara will always be the first one of the
+ * next paragraph, by definition, even if it's \f or another \newpara */
+ create_paragraph(fr, sc_block_next(mrb), sc_block_next(bl));
}
@@ -973,18 +975,19 @@ static int add_text(struct frame *fr, PangoContext *pc, SCBlock *bl,
fontdesc = sc_interp_get_fontdesc(scin);
col = sc_interp_get_fgcol(scin);
+ rbl = bl;
+ if ( st->macro_real_block != NULL ) {
+ bl = st->macro_real_block;
+ }
+
para = last_para(fr);
if ( (para == NULL) || (para_type(para) != PARA_TYPE_TEXT) ) {
/* Last paragraph is not text.
* or: no paragraphs yet.
* Either way: Create the first one */
- para = create_paragraph(fr);
+ para = create_paragraph(fr, bl, rbl);
}
- rbl = bl;
- if ( st->macro_real_block != NULL ) {
- bl = st->macro_real_block;
- }
add_run(para, bl, rbl, fontdesc, col);
set_para_spacing(para, st->paraspace);
@@ -1011,7 +1014,7 @@ static int check_outputs(SCBlock *bl, SCInterpreter *scin)
{
SCBlock *rbl = bl;
if ( st->macro_real_block != NULL ) {
- rbl = st->macro_real_block;
+ bl = st->macro_real_block;
}
add_image_para(sc_interp_get_frame(scin), bl, rbl,
filename, scin->is, w, h, 1);
@@ -1048,7 +1051,11 @@ static int check_outputs(SCBlock *bl, SCInterpreter *scin)
} else if ( strcmp(name, "newpara")==0 ) {
struct frame *fr = sc_interp_get_frame(scin);
- add_newpara(fr, bl);
+ SCBlock *rbl = bl;
+ if ( st->macro_real_block != NULL ) {
+ bl = st->macro_real_block;
+ }
+ add_newpara(fr, bl, rbl);
} else {
return 0;