Skip to content

Commit

Permalink
Allow OnJumpLetter() to skip to the next item on a miss.
Browse files Browse the repository at this point in the history
In addition to the old behavior we can cycle, eg all items starting with
an 'a' by repeatedly typing 'A'.
  • Loading branch information
t-nelson committed Oct 3, 2012
1 parent 58d3e4d commit b07d4c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions xbmc/guilib/GUIBaseContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ void CGUIBaseContainer::OnPrevLetter()
}
}

void CGUIBaseContainer::OnJumpLetter(char letter)
void CGUIBaseContainer::OnJumpLetter(char letter, bool skip /*=false*/)
{
if (m_matchTimer.GetElapsedMilliseconds() < letter_match_timeout)
m_match.push_back(letter);
Expand All @@ -533,7 +533,7 @@ void CGUIBaseContainer::OnJumpLetter(char letter)

// find the current letter we're focused on
unsigned int offset = CorrectOffset(GetOffset(), GetCursor());
unsigned int i = offset;
unsigned int i = (offset + ((skip) ? 1 : 0)) % m_items.size();
do
{
CGUIListItemPtr item = m_items[i];
Expand All @@ -548,7 +548,7 @@ void CGUIBaseContainer::OnJumpLetter(char letter)
if (m_match.size() > 1)
{
m_match.clear();
OnJumpLetter(letter);
OnJumpLetter(letter, true);
}
}

Expand Down
2 changes: 1 addition & 1 deletion xbmc/guilib/GUIBaseContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class CGUIBaseContainer : public CGUIControl
bool ScrollingUp() const { return m_scroller.IsScrollingUp(); };
void OnNextLetter();
void OnPrevLetter();
void OnJumpLetter(char letter);
void OnJumpLetter(char letter, bool skip = false);
void OnJumpSMS(int letter);
std::vector< std::pair<int, CStdString> > m_letterOffsets;

Expand Down

0 comments on commit b07d4c3

Please sign in to comment.