Skip to content

Commit

Permalink
Prevent focusing on black squares within a word.
Browse files Browse the repository at this point in the history
We can only focus on squares which are white (unless the puzzle is
diagramless). So when a user presses an arrow key, even if the next
square in that direction is part of the current word, we should not
attempt to focus on it unless one of those conditions match.

Fixes mrichards42#146
  • Loading branch information
jpd236 committed Jun 5, 2021
1 parent 133af2b commit c4be463
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/XGridCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,8 @@ XGridCtrl::OnArrow(puz::GridDirection arrowDirection, int mod)
{
// Check to see if the next square is part of the current word
if (m_focusedWord &&
m_focusedWord->Contains(m_focusedSquare->Next(arrowDirection)))
m_focusedWord->Contains(m_focusedSquare->Next(arrowDirection)) &&
m_focusedSquare->Next(arrowDirection)->IsWhite())
{
SetFocusedSquare(m_focusedSquare->Next(arrowDirection),
m_focusedWord);
Expand Down

0 comments on commit c4be463

Please sign in to comment.