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)
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;