aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRene Gollent <anevilyak@gmail.com>2012-07-18 23:00:53 -0400
committerRene Gollent <anevilyak@gmail.com>2012-07-18 23:02:30 -0400
commited15f1b8fb8b635349829c655678177ad3032ccc (patch)
tree885d9ddb9ea6a003b97b72bcd76fa9a5c4a1fce4
parentaf2f75a0167a11a9a9fa212a0a4e5d2671cfd8a1 (diff)
Fix scrollbar handling when removing rows in BCLV.hrev44353
- If removing a row results in there no longer being any rows whatsoever visible, force a scroll back into the visible range. Fixes #8287.
-rw-r--r--src/kits/interface/ColumnListView.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/kits/interface/ColumnListView.cpp b/src/kits/interface/ColumnListView.cpp
index baa05a2822..8123c690d3 100644
--- a/src/kits/interface/ColumnListView.cpp
+++ b/src/kits/interface/ColumnListView.cpp
@@ -4090,6 +4090,16 @@ OutlineView::RemoveRow(BRow* row)
fItemsHeight -= subTreeHeight;
FixScrollBar(false);
+ int32 indent = 0;
+ float top = 0.0;
+ if (FindRow(fVisibleRect.top, &indent, &top) == NULL && ScrollBar(B_VERTICAL) != NULL) {
+ // after removing this row, no rows are actually visible any more,
+ // force a scroll to make them visible again
+ if (fItemsHeight > fVisibleRect.Height())
+ ScrollBy(0.0, fItemsHeight - fVisibleRect.Height() - Bounds().top);
+ else
+ ScrollBy(0.0, -Bounds().top);
+ }
if (parentRow != NULL) {
parentRow->fChildList->RemoveItem(row);
if (parentRow->fChildList->CountItems() == 0) {
@@ -4294,7 +4304,7 @@ OutlineView::FixScrollBar(bool scrollToFit)
float maxScrollBarValue = fItemsHeight - fVisibleRect.Height();
vScrollBar->SetProportion(fVisibleRect.Height() / fItemsHeight);
- // If the user is scrolled down too far when makes the range smaller, the list
+ // If the user is scrolled down too far when making the range smaller, the list
// will jump suddenly, which is undesirable. In this case, don't fix the scroll
// bar here. In ScrollTo, it checks to see if this has occured, and will
// fix the scroll bars sneakily if the user has scrolled up far enough.