From 586e02e915f33e304f5f5e664d29efd2940a4dcf Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 8 Feb 2013 20:03:44 +0000 Subject: Implement text selection auto-scroll. --- desktop/textarea.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'desktop') diff --git a/desktop/textarea.c b/desktop/textarea.c index 329354859..be02d50ea 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -2102,9 +2102,25 @@ bool textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse, } else if (mouse & BROWSER_MOUSE_HOLDING_1 && ta->drag_info.type == TEXTAREA_DRAG_SELECTION) { /* Selection track */ + int scrx = 0; + int scry = 0; + textarea_get_xy_offset(ta, x, y, &c_off); c_start = ta->drag_start_char; c_end = c_off; + + /* selection auto-scroll */ + if (x < 0) + scrx = x / 4; + if (y < 0) + scry = y / 4; + if (x > ta->vis_width) + scrx = (x - ta->vis_width) / 4; + if (y > ta->vis_height) + scry = (y - ta->vis_height) / 4; + + textarea_scroll(ta, scrx, scry); + return textarea_select(ta, c_start, c_end); } -- cgit v1.2.3