Index: libs/libmythtv/guidegrid.cpp =================================================================== --- libs/libmythtv/guidegrid.cpp (revision 20550) +++ libs/libmythtv/guidegrid.cpp (working copy) @@ -2157,20 +2157,35 @@ // Not the best method, but the channel list is small and this isn't time critical // Go through until the ith channel is equal to or greater than the one we're looking for - for (i=0; (i < GetChannelCount()-1) && - (GetChannelInfo(i)->channum.toInt() < jumpToChannel); i++); + if (sortReverse) + { + for (i=GetChannelCount()-2; (i>0) && + (GetChannelInfo(i)->channum.toInt() < jumpToChannel); i--); - if ((i > 0) && - ((GetChannelInfo(i)->channum.toInt() - jumpToChannel) > - (jumpToChannel - GetChannelInfo(i-1)->channum.toInt()))) + if ((i < GetChannelCount()-2) && + ((GetChannelInfo(i)->channum.toInt() - jumpToChannel) > + (jumpToChannel - GetChannelInfo(i+1)->channum.toInt()))) + { + i++; + } + } + else { - i--; + for (i=0; (i < GetChannelCount()-1) && + (GetChannelInfo(i)->channum.toInt() < jumpToChannel); i++); + + if ((i > 0) && + ((GetChannelInfo(i)->channum.toInt() - jumpToChannel) > + (jumpToChannel - GetChannelInfo(i-1)->channum.toInt()))) + { + i--; + } } // DISPLAY_CHANS to center setStartChannel(i-DISPLAY_CHANS/2); m_currentRow = DISPLAY_CHANS/2; - + fillProgramInfos(); repaint(fullRect, false);