Skip to content

Commit

Permalink
Fix more issues with navigating through grids with annotation squares.
Browse files Browse the repository at this point in the history
Adjust all default usage of FindPrevSquare and FindNextSquare to use
the FIND_WHITE_SQUARE find function to ensure they skip over any
annotation squares instead of trying to focus on them.

See #146
  • Loading branch information
jpd236 committed Jun 6, 2021
1 parent ea83fee commit 4d1f01a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/XGridCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1550,7 +1550,7 @@ XGridCtrl::OnLetter(wxChar key, int mod)

// Space bar always moves forward one square
if (static_cast<int>(key) == WXK_SPACE)
SetFocusedSquare(m_focusedWord->FindNextSquare(m_focusedSquare), m_focusedWord);
SetFocusedSquare(m_focusedWord->FindNextSquare(m_focusedSquare, FIND_WHITE_SQUARE), m_focusedWord);
else
MoveAfterLetter();
}
Expand Down Expand Up @@ -1578,7 +1578,7 @@ XGridCtrl::MoveAfterLetter()
// word. Move to the next letter if it exists
if (newSquare == NULL)
{
newSquare = m_focusedWord->FindNextSquare(m_focusedSquare);
newSquare = m_focusedWord->FindNextSquare(m_focusedSquare, FIND_WHITE_SQUARE);
// if newSquare == NULL (possibly again), it's the last square in the word,
// and the focus won't change.
}
Expand Down Expand Up @@ -1696,7 +1696,7 @@ XGridCtrl::OnBackspace(int WXUNUSED(mod))
{
wxASSERT(! IsEmpty());
SetSquareText(*m_focusedSquare, _T(""));
SetFocusedSquare(m_focusedWord->FindPrevSquare(m_focusedSquare),
SetFocusedSquare(m_focusedWord->FindPrevSquare(m_focusedSquare, FIND_WHITE_SQUARE),
m_focusedWord);
}

Expand Down

0 comments on commit 4d1f01a

Please sign in to comment.