Commit e14ddb14 authored by Erwan Tulou's avatar Erwan Tulou

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)
parent 4d79e227
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment