aboutsummaryrefslogtreecommitdiff
path: root/src/frame.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-03-04 22:06:45 +0100
committerThomas White <taw@physics.org>2018-03-04 22:06:45 +0100
commit9a5cc035b87a697032ac4977836518fd8161c2fc (patch)
tree5052a0a662e0c97625880cb204139ff7cdde160b /src/frame.c
parent6634bdb38e40772cdb263deb94efe170f90cd0dc (diff)
Paragraph splitting fixes
Diffstat (limited to 'src/frame.c')
-rw-r--r--src/frame.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/frame.c b/src/frame.c
index 13a7909..eaa4f41 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1577,6 +1577,7 @@ static SCBlock *split_text_paragraph(struct frame *fr, int pn, size_t pos,
{
Paragraph *pnew;
int i;
+ SCBlock *nnp;
size_t run_offs;
int run;
Paragraph *para = fr->paras[pn];
@@ -1614,10 +1615,16 @@ static SCBlock *split_text_paragraph(struct frame *fr, int pn, size_t pos,
if ( run == para->n_runs-1 ) {
- /* It's actually a paragraph boundary. Even easier still... */
- printf("splitting at end of para\n");
- pnew->runs[0].scblock = rr->scblock;
- pnew->runs[0].rscblock = rr->rscblock;
+ printf("Simple new para\n");
+
+ /* Right at the end of a paragraph:
+ * - don't touch the current paragraph
+ * - add a new paragraph after
+ * - .. containing just a \newpara block and run */
+
+ nnp = sc_block_append(rr->scblock, strdup("newpara"), NULL, NULL, NULL);
+ pnew->runs[0].scblock = nnp;
+ pnew->runs[0].rscblock = nnp;
pnew->runs[0].fontdesc = pango_font_description_copy(rr->fontdesc);
pnew->runs[0].col[0] = rr->col[0];
pnew->runs[0].col[1] = rr->col[1];
@@ -1625,6 +1632,14 @@ static SCBlock *split_text_paragraph(struct frame *fr, int pn, size_t pos,
pnew->runs[0].col[3] = rr->col[3];
pnew->n_runs = 1;
+ set_newline_at_end(pnew, nnp);
+
+ pnew->open = para->open;
+ para->open = 0;
+
+ wrap_paragraph(pnew, pc, fr->w - fr->pad_l - fr->pad_r, 0, 0);
+
+ return nnp;
} else {
@@ -1676,9 +1691,9 @@ static SCBlock *split_text_paragraph(struct frame *fr, int pn, size_t pos,
}
/* Add a \newpara after the end of the first paragraph's SC */
- set_newline_at_end(para,
- sc_block_append(rr->scblock, strdup("newpara"),
- NULL, NULL, NULL));
+ nnp = sc_block_append(rr->scblock, strdup("newpara"), NULL, NULL, NULL);
+ add_run(para, nnp, nnp, 0, rr->fontdesc, rr->col);
+ set_newline_at_end(para, nnp);
pnew->open = para->open;
para->open = 0;