aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-09-24 11:01:49 +0200
committerThomas White <taw@physics.org>2017-09-24 11:01:49 +0200
commitea5997b711faf2214304e4b6b60588ca61be14e6 (patch)
tree2a728cdefe02c7785cfb28e111be2cced9002d4b
parent663249781907aeba19069ca558f3275ac4ff6cd7 (diff)
Handle paragraph split at end of paragraph
-rw-r--r--src/frame.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/frame.c b/src/frame.c
index eebb171..b224d1c 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1274,9 +1274,31 @@ static SCBlock *split_text_paragraph(struct frame *fr, int pn, size_t pos,
if ( rr->len_bytes == run_offs ) {
/* We are splitting at a run boundary, so things are easy */
- pnew->runs[0] = para->runs[run+1];
- pnew->runs[0].para_offs_bytes = 0;
- pnew->n_runs = 1;
+
+ if ( run == para->n_runs-1 ) {
+
+ /* It's actually a paragraph boundary. Even easier still... */
+ pnew->runs[0].para_offs_bytes = 0;
+ pnew->runs[0].scblock = rr->scblock;
+ pnew->runs[0].macro_real_block = rr->macro_real_block;
+ pnew->runs[0].scblock_offs_bytes = rr->scblock_offs_bytes + run_offs;
+ pnew->runs[0].para_offs_bytes = 0;
+ pnew->runs[0].len_bytes = 0;
+ 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];
+ pnew->runs[0].col[2] = rr->col[2];
+ pnew->runs[0].col[3] = rr->col[3];
+ pnew->n_runs = 1;
+
+
+ } else {
+
+ pnew->runs[0] = para->runs[run+1];
+ pnew->runs[0].para_offs_bytes = 0;
+ pnew->n_runs = 1;
+
+ }
/* We start copying runs after the whole second one which we
* just brought forward, i.e. we start at the THIRD run */