diff options
-rw-r--r-- | desktop/textarea.c | 24 |
1 files changed, 15 insertions, 9 deletions
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); |