From c8a0138b3b69a54bf4097a1ee8df32c5ea3d60ef Mon Sep 17 00:00:00 2001 From: Rafael Cavalcanti Date: Sat, 28 Dec 2019 18:53:21 -0300 Subject: [PATCH] Desktop: Fixes #2122: Fix Goto Anything scrolling issue (#2199) * Fix Goto scrolling (#2122) * Better fix to Goto scrolling (#2122) * Fix #2122: fix bottomItemIndex and top values --- ElectronClient/app/gui/ItemList.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ElectronClient/app/gui/ItemList.jsx b/ElectronClient/app/gui/ItemList.jsx index 80671ee29..4d2e516a0 100644 --- a/ElectronClient/app/gui/ItemList.jsx +++ b/ElectronClient/app/gui/ItemList.jsx @@ -23,7 +23,7 @@ class ItemList extends React.Component { const topItemIndex = Math.floor(this.scrollTop_ / props.itemHeight); const visibleItemCount = this.visibleItemCount(props); - let bottomItemIndex = topItemIndex + visibleItemCount; + let bottomItemIndex = topItemIndex + (visibleItemCount - 1); if (bottomItemIndex >= props.items.length) bottomItemIndex = props.items.length - 1; this.setState({ @@ -50,7 +50,7 @@ class ItemList extends React.Component { } makeItemIndexVisible(itemIndex) { - const top = Math.min(this.props.items.length - 1, this.state.topItemIndex + 1); + const top = Math.min(this.props.items.length - 1, this.state.topItemIndex); const bottom = Math.max(0, this.state.bottomItemIndex); if (itemIndex >= top && itemIndex <= bottom) return;