summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-02-09 13:34:28 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2013-02-09 13:34:28 +0000
commit048b344a438dba1ff588c7a6fb3f9b67a1c7561e (patch)
treee3ef576302b7f50bfabe537439206d9703c88c1a /desktop
parentf848de3dd0933b9b42ecf39b9f1c337f22ad0a19 (diff)
downloadnetsurf-048b344a438dba1ff588c7a6fb3f9b67a1c7561e.tar.gz
netsurf-048b344a438dba1ff588c7a6fb3f9b67a1c7561e.tar.bz2
Take account of scrollbar-occupied regions.
Diffstat (limited to 'desktop')
-rw-r--r--desktop/textarea.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/desktop/textarea.c b/desktop/textarea.c
index 134d34b78..9ba5f1e65 100644
--- a/desktop/textarea.c
+++ b/desktop/textarea.c
@@ -264,16 +264,18 @@ static bool textarea_scroll_visible(struct textarea *ta)
int xs = ta->scroll_x;
int ys = ta->scroll_y;
int vis;
+ int scrollbar_width;
bool scrolled = false;
if (ta->caret_pos.char_off == -1)
return false;
+ scrollbar_width = (ta->bar_y == NULL) ? 0 : SCROLLBAR_WIDTH;
x0 = ta->border_width + ta->pad_left;
x1 = ta->vis_width - (ta->border_width + ta->pad_right);
/* Adjust scroll pos for reduced extents */
- vis = ta->vis_width - 2 * ta->border_width;
+ vis = ta->vis_width - 2 * ta->border_width - scrollbar_width;
if (ta->h_extent - xs < vis)
xs -= vis - (ta->h_extent - xs);
@@ -311,12 +313,13 @@ static bool textarea_scroll_visible(struct textarea *ta)
/* check and change vertical scroll */
if (ta->flags & TEXTAREA_MULTILINE) {
+ scrollbar_width = (ta->bar_x == NULL) ? 0 : SCROLLBAR_WIDTH;
y0 = 0;
y1 = ta->vis_height - 2 * ta->border_width -
ta->pad_top - ta->pad_bottom;
/* Adjust scroll pos for reduced extents */
- vis = ta->vis_height - 2 * ta->border_width;
+ vis = ta->vis_height - 2 * ta->border_width - scrollbar_width;
if (ta->v_extent - ys < vis)
ys -= vis - (ta->v_extent - ys);