aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2015-08-18 23:55:18 +0200
committerThomas White <taw@bitwiz.org.uk>2015-08-18 23:55:18 +0200
commitc3eb827e44633ae7633f519cd803cb79e71f2aee (patch)
treebdc8caff4a4097ce8affe98f50786067c68dc4e0
parent2a7a259de1514997c6a973d372d332fbdddf7f8e (diff)
Fix calculation of end bit
-rw-r--r--src/shape.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/shape.c b/src/shape.c
index e5c568c..6784ee3 100644
--- a/src/shape.c
+++ b/src/shape.c
@@ -274,6 +274,7 @@ int split_words(struct wrap_line *boxes, PangoContext *pc, SCBlock *bl,
PangoLogAttr *log_attrs;
glong len_chars, i;
size_t len_bytes, start;
+ int chars_done;
/* Empty block? */
if ( text == NULL ) return 1;
@@ -295,6 +296,7 @@ int split_words(struct wrap_line *boxes, PangoContext *pc, SCBlock *bl,
//debug_log_attrs(len_chars, text, log_attrs);
start = 0;
+ chars_done = 0;
for ( i=0; i<len_chars; i++ ) {
if ( log_attrs[i].is_line_break ) {
@@ -327,13 +329,14 @@ int split_words(struct wrap_line *boxes, PangoContext *pc, SCBlock *bl,
fprintf(stderr, "Failed to add wrap box.\n");
}
start = offs;
+ chars_done = i;
}
}
/* Add the stuff left over at the end */
- if ( i > start ) {
+ if ( i > chars_done ) {
size_t l = strlen(text+start);