From 93550c8bee5e3c914b5c5a1b5993d40f0033d117 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 19 Aug 2019 08:14:31 +0200 Subject: WIP --- libstorycode/gtk/gtknarrativeview.c | 5 +++++ libstorycode/gtk/gtkslideview.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'libstorycode/gtk') diff --git a/libstorycode/gtk/gtknarrativeview.c b/libstorycode/gtk/gtknarrativeview.c index 83d6d23..82dd138 100644 --- a/libstorycode/gtk/gtknarrativeview.c +++ b/libstorycode/gtk/gtknarrativeview.c @@ -885,6 +885,11 @@ static int find_cursor(Narrative *n, double x, double y, struct edit_pos *pos) pango_units_from_double(y - n->space_t - para_top(n, pos->para)), &pos->pos, &pos->trail); + /* pos->pos is the byte index into item->layout_text */ + //printf("click pos = %i\n", pos->pos); + //pos->pos = index_before_removal(item->chars_removed, item->n_chars_removed, pos->pos); + //printf("after adjustment: %i\n", pos->pos); + return 0; } diff --git a/libstorycode/gtk/gtkslideview.c b/libstorycode/gtk/gtkslideview.c index 9766572..0ec1c5f 100644 --- a/libstorycode/gtk/gtkslideview.c +++ b/libstorycode/gtk/gtkslideview.c @@ -570,8 +570,8 @@ static int find_cursor(SlideItem *item, Stylesheet *stylesheet, pos->para = i-1; pango_layout_xy_to_index(item->paras[i-1].layout, - pango_units_from_double(x), - pango_units_from_double(y - top), + pango_units_from_double(x - padl), + pango_units_from_double(y - top - padt), &pos->pos, &pos->trail); return 0; } -- cgit v1.2.3