From cc1d3ce2f02f23e46898fa418309310bd311e92b Mon Sep 17 00:00:00 2001 From: Tobias Predel Date: Fri, 15 Sep 2023 18:47:40 +0200 Subject: [PATCH] Consider scrollbars overlapping the scrolled window at its edges This assumes that the horizontal scrollbar is at the bottom edge and that the vertical scrollbar is at the right edge of the scrolled window. This commit should avoid the situation where the selection to scroll to is hidden behind the scrollbar. --- src/document.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/document.h b/src/document.h index 19534e3a..d340aacd 100755 --- a/src/document.h +++ b/src/document.h @@ -273,17 +273,17 @@ struct Document { sw->GetClientSize(&canvasw, &canvash); if ((layoutys > canvash || layoutxs > canvasw) && s.g) { wxRect r = s.g->GetRect(this, s, true); - if (r.y < originy || r.y + r.height > maxy || r.x < originx || - r.x + r.width > maxx) { + if (r.y < originy || r.y + r.height > maxy - wxSYS_HSCROLL_Y || r.x < originx || + r.x + r.width > maxx - wxSYS_VSCROLL_X) { int curx, cury; sw->GetViewStart(&curx, &cury); sw->SetScrollbars(1, 1, layoutxs, layoutys, - r.width > canvasw || r.x < originx + r.width > canvasw - wxSYS_VSCROLL_X || r.x < originx ? r.x - : r.x + r.width > maxx ? r.x + r.width - canvasw : curx, - r.height > canvash || r.y < originy + : r.x + r.width > maxx - wxSYS_VSCROLL_X ? r.x + r.width - canvasw + wxSYS_VSCROLL_X: curx, + r.height > canvash - wxSYS_HSCROLL_Y || r.y < originy ? r.y - : r.y + r.height > maxy ? r.y + r.height - canvash : cury, + : r.y + r.height > maxy - wxSYS_HSCROLL_Y ? r.y + r.height - canvash + wxSYS_HSCROLL_Y : cury, true); RefreshReset(); return true;