Skip to content
This repository
Browse code

Allow OnJumpLetter() to skip to the next item on a miss.

In addition to the old behavior we can cycle, eg all items starting with
an 'a' by repeatedly typing 'A'.
  • Loading branch information...
commit b07d4c3f29fea9d01d041835fba1471e7162093f 1 parent 58d3e4d
Trent Nelson authored October 02, 2012
6  xbmc/guilib/GUIBaseContainer.cpp
@@ -518,7 +518,7 @@ void CGUIBaseContainer::OnPrevLetter()
518 518
   }
519 519
 }
520 520
 
521  
-void CGUIBaseContainer::OnJumpLetter(char letter)
  521
+void CGUIBaseContainer::OnJumpLetter(char letter, bool skip /*=false*/)
522 522
 {
523 523
   if (m_matchTimer.GetElapsedMilliseconds() < letter_match_timeout)
524 524
     m_match.push_back(letter);
@@ -533,7 +533,7 @@ void CGUIBaseContainer::OnJumpLetter(char letter)
533 533
 
534 534
   // find the current letter we're focused on
535 535
   unsigned int offset = CorrectOffset(GetOffset(), GetCursor());
536  
-  unsigned int i      = offset;
  536
+  unsigned int i      = (offset + ((skip) ? 1 : 0)) % m_items.size();
537 537
   do
538 538
   {
539 539
     CGUIListItemPtr item = m_items[i];
@@ -548,7 +548,7 @@ void CGUIBaseContainer::OnJumpLetter(char letter)
548 548
   if (m_match.size() > 1)
549 549
   {
550 550
     m_match.clear();
551  
-    OnJumpLetter(letter);
  551
+    OnJumpLetter(letter, true);
552 552
   }
553 553
 }
554 554
 
2  xbmc/guilib/GUIBaseContainer.h
@@ -178,7 +178,7 @@ class CGUIBaseContainer : public CGUIControl
178 178
   bool ScrollingUp() const { return m_scroller.IsScrollingUp(); };
179 179
   void OnNextLetter();
180 180
   void OnPrevLetter();
181  
-  void OnJumpLetter(char letter);
  181
+  void OnJumpLetter(char letter, bool skip = false);
182 182
   void OnJumpSMS(int letter);
183 183
   std::vector< std::pair<int, CStdString> > m_letterOffsets;
184 184
 

0 notes on commit b07d4c3

Please sign in to comment.
Something went wrong with that request. Please try again.