From 9c21874d33cdffb431cbb70ac14fe7273a74aa4a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 1 Mar 2019 11:04:55 +0100 Subject: [PATCH] LibGUI: GTableView scrolling ranges should be based on the available area. We have to subtract the headers and scrollbars to get the correct behavior. --- LibGUI/GTableView.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/LibGUI/GTableView.cpp b/LibGUI/GTableView.cpp index c873291117..608a2bc4a6 100644 --- a/LibGUI/GTableView.cpp +++ b/LibGUI/GTableView.cpp @@ -47,10 +47,12 @@ void GTableView::resize_event(GResizeEvent& event) void GTableView::update_scrollbar_ranges() { - int excess_height = max(0, (item_count() * item_height()) - height()); + int available_height = height() - header_height() - m_horizontal_scrollbar->height(); + int excess_height = max(0, (item_count() * item_height()) - available_height); m_vertical_scrollbar->set_range(0, excess_height); - int excess_width = max(0, content_width() - width()); + int available_width = width() - m_vertical_scrollbar->width(); + int excess_width = max(0, content_width() - available_width); m_horizontal_scrollbar->set_range(0, excess_width); }