From 490de208d0be50c8dd4aca055807931e00a98e60 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 6 Mar 2013 21:31:20 +0000 Subject: Make autoscroll start at inside edge of border or scrollbar. --- desktop/textarea.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'desktop') diff --git a/desktop/textarea.c b/desktop/textarea.c index 54f45587f..46de70639 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -2375,22 +2375,28 @@ bool textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse, /* Selection track */ int scrx = 0; int scry = 0; + int w, h; bool need_redraw; textarea_get_xy_offset(ta, x, y, &c_off); c_start = ta->drag_start_char; c_end = c_off; + w = ta->vis_width - ta->border_width - + ((ta->bar_y == NULL) ? 0 : SCROLLBAR_WIDTH); + h = ta->vis_height - ta->border_width - + ((ta->bar_x == NULL) ? 0 : SCROLLBAR_WIDTH); + /* selection auto-scroll */ - if (x < 0) - scrx = x / 4; - else if (x > ta->vis_width) - scrx = (x - ta->vis_width) / 4; - - if (y < 0) - scry = y / 4; - else if (y > ta->vis_height) - scry = (y - ta->vis_height) / 4; + if (x < ta->border_width) + scrx = (x - ta->border_width) / 4; + else if (x > w) + scrx = (x - w) / 4; + + if (y < ta->border_width) + scry = (y - ta->border_width) / 4; + else if (y > h) + scry = (y - h) / 4; need_redraw = textarea_scroll(ta, scrx, scry); -- cgit v1.2.3