aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/frame.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/frame.c b/src/frame.c
index 1bc21bc..656bf5c 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1312,6 +1312,19 @@ void merge_paragraphs(struct frame *fr, int para)
return;
}
+ /* Delete the \newpara block to unite the paragraphs */
+ n = get_newline_at_end(p1);
+ assert(n != NULL);
+
+ if ( sc_block_delete(&fr->scblocks, n) ) {
+ if ( p1->runs[p1->n_runs-1].macro_contents != NULL ) {
+ if ( sc_block_delete(&p1->runs[p1->n_runs-1].macro_contents, n) ) {
+ fprintf(stderr, "Failed to delete paragraph end sentinel.\n");
+ return;
+ }
+ }
+ }
+
/* All the runs from p2 get added to p1 */
runs_new = realloc(p1->runs,
(p1->n_runs+p2->n_runs)*sizeof(struct text_run));
@@ -1321,11 +1334,6 @@ void merge_paragraphs(struct frame *fr, int para)
}
p1->runs = runs_new;
- /* Delete the \newpara block to unite the paragraphs */
- n = get_newline_at_end(p1);
- assert(n != NULL);
- sc_block_delete(&fr->scblocks, n);
-
/* The end of the united paragraph should now be the end of the
* second one */
set_newline_at_end(p1, get_newline_at_end(p2));