fixing comparison warning

This commit is contained in:
Seth Hillbrand 2019-09-04 11:05:33 -07:00
parent 24454f5105
commit 37b3c698c8
1 changed files with 5 additions and 6 deletions

View File

@ -502,12 +502,9 @@ void DIALOG_SHIM::OnCharHook( wxKeyEvent& aEvt )
auto advance = [&]( int& idx ) auto advance = [&]( int& idx )
{ {
idx += delta; // Wrap-around modulus
int size = m_tabOrder.size();
if( idx < 0 ) idx = ( ( idx + delta ) % size + size ) % size;
idx = m_tabOrder.size() - 1;
else if ( idx >= m_tabOrder.size() )
idx = 0;
}; };
for( size_t i = 0; i < m_tabOrder.size(); ++i ) for( size_t i = 0; i < m_tabOrder.size(); ++i )
@ -523,6 +520,8 @@ void DIALOG_SHIM::OnCharHook( wxKeyEvent& aEvt )
{ {
advance( currentIdx ); advance( currentIdx );
//todo: We don't currently have non-textentry dialog boxes but this will break if
// we add them.
#ifdef __APPLE__ #ifdef __APPLE__
while( dynamic_cast<wxTextEntry*>( m_tabOrder[ currentIdx ] ) == nullptr ) while( dynamic_cast<wxTextEntry*>( m_tabOrder[ currentIdx ] ) == nullptr )
advance( currentIdx ); advance( currentIdx );