aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.me.uk>2019-10-10 22:33:58 +0200
committerThomas White <taw@bitwiz.me.uk>2019-10-10 22:33:58 +0200
commit915085f769b23a1178c55cb045a28952095e8c19 (patch)
tree3c1a24d9820e35dceb4afbaa1e6ee5ab147be37f
parentfe64bad2147d1abd20740873886ab95482b7c626 (diff)
Fix gtksv_end_offset_of_para for runs
-rw-r--r--libstorycode/gtk/gtkslideview.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libstorycode/gtk/gtkslideview.c b/libstorycode/gtk/gtkslideview.c
index 42165ac..2697d5f 100644
--- a/libstorycode/gtk/gtkslideview.c
+++ b/libstorycode/gtk/gtkslideview.c
@@ -969,10 +969,18 @@ static gboolean gtksv_button_release_sig(GtkWidget *da, GdkEventButton *event,
static size_t gtksv_end_offset_of_para(SlideItem *item, int pnum)
{
struct slide_text_paragraph *para;
+ int i;
+ size_t offs;
+
assert(pnum >= 0);
if ( !is_text(item->type) ) return 0;
para = &item->paras[pnum];
- return strlen(para->runs[para->n_runs-1].text);
+
+ offs = 0;
+ for ( i=0; i<para->n_runs; i++ ) {
+ offs += strlen(para->runs[i].text);
+ }
+ return offs;
}