diff options
author | Sebastian Geerken <devnull@localhost> | 2014-09-17 23:04:18 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2014-09-17 23:04:18 +0200 |
commit | b968c298957c20d28908b7050708807049f9fccb (patch) | |
tree | 7021995baca7830d5bd460b12f65bdced145a7b7 | |
parent | e74a39fffeeba0e42dfc781eceb152a028c95a24 (diff) |
Fixed "holes" in paragraphs list after hyphenation.
-rw-r--r-- | dw/textblock_linebreaking.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index 0d21c461..c507cb68 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -1435,6 +1435,18 @@ void Textblock::moveWordIndices (int wordIndex, int num, int *addIndex1) } } + // Unlike the last line, the last paragraph is already constructed. (To + // make sure we cover all cases, we iterate over the last paragraphs.) + Paragraph *par; + for (int parNo = paragraphs->size () - 1; + parNo >= 0 && + (par = paragraphs->getRef(parNo)) && par->lastWord > wordIndex; + parNo--) { + par->lastWord += num; + if (par->firstWord > wordIndex) + par->firstWord += num; + } + // Addiditional indices. When needed, the number can be extended. if (addIndex1 && *addIndex1 >= wordIndex) *addIndex1 += num; |