From e14ddb1442a8215a4dc3a6a19bba737e17d9fc4e Mon Sep 17 00:00:00 2001 From: Erwan Tulou Date: Thu, 5 Aug 2010 18:05:45 +0200 Subject: [PATCH] skins2: fix arrows short of 1 For n items, index spans from 0 to (n-1). This issue accounted for arrows failing to move the cursor past the end of the visible list (short of 1 click) --- modules/gui/skins2/controls/ctrl_tree.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/gui/skins2/controls/ctrl_tree.cpp b/modules/gui/skins2/controls/ctrl_tree.cpp index c31962c491..b8be9b453f 100644 --- a/modules/gui/skins2/controls/ctrl_tree.cpp +++ b/modules/gui/skins2/controls/ctrl_tree.cpp @@ -697,13 +697,13 @@ bool CtrlTree::ensureVisible( int focusItemIndex ) if( it != m_rTree.end() && ( focusItemIndex < firstPosIndex - || focusItemIndex > firstPosIndex + maxItems() ) ) + || focusItemIndex > firstPosIndex + maxItems() - 1 ) ) { // Scroll to have the wanted stream visible VarPercent &rVarPos = m_rTree.getPositionVar(); - rVarPos.set( 1.0 - (double)focusItemIndex / - (double)( m_flat ? m_rTree.countLeafs() - : m_rTree.visibleItems() ) ); + int indexMax = ( m_flat ? m_rTree.countLeafs() + : m_rTree.visibleItems() ) - 1; + rVarPos.set( 1.0 - (double)focusItemIndex / (double)indexMax ); return true; } return false; -- 2.39.2