From 1f787e13a6c75cf12a09fc44d590ba9169c52a71 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 26 Jun 2018 14:45:15 +0200 Subject: Add fz_snap_selection function to snap selection to chars/words/lines. Updates the input point coordinates, and also returns a quad with appropriate UI handles. --- platform/gl/gl-main.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'platform/gl/gl-main.c') diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c index 726de1c0..ee182cdd 100644 --- a/platform/gl/gl-main.c +++ b/platform/gl/gl-main.c @@ -489,6 +489,11 @@ static void do_page_selection(void) fz_transform_point(&page_a, &view_page_inv_ctm); fz_transform_point(&page_b, &view_page_inv_ctm); + if (ui.mod == GLUT_ACTIVE_CTRL) + fz_snap_selection(ctx, page_text, &page_a, &page_b, FZ_SELECT_WORDS); + else if (ui.mod == GLUT_ACTIVE_CTRL + GLUT_ACTIVE_SHIFT) + fz_snap_selection(ctx, page_text, &page_a, &page_b, FZ_SELECT_LINES); + n = fz_highlight_selection(ctx, page_text, page_a, page_b, hits, nelem(hits)); glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO); /* invert destination color */ -- cgit v1.2.3