From c4be463ab0d985b8740af922a1a21ce6fc1ab479 Mon Sep 17 00:00:00 2001 From: Jeff Davidson Date: Sat, 5 Jun 2021 16:32:26 -0700 Subject: [PATCH] Prevent focusing on black squares within a word. 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 #146 --- src/XGridCtrl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/XGridCtrl.cpp b/src/XGridCtrl.cpp index af49c0cb..86d4d6ae 100644 --- a/src/XGridCtrl.cpp +++ b/src/XGridCtrl.cpp @@ -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);